summaryrefslogtreecommitdiff
path: root/editor/debugger/script_editor_debugger.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-10-06 11:45:27 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-10-06 11:45:27 +0200
commit4d29346a7413db874b03525112211a1368036d4d (patch)
treed404048622662c48f4cadd6b46496337617f3b42 /editor/debugger/script_editor_debugger.cpp
parent61021c08f80856f8d99dfbe9fd3d338ef5f41999 (diff)
Debugger: Fix fetching source to link C++ error on GitHub
Fixes #66974.
Diffstat (limited to 'editor/debugger/script_editor_debugger.cpp')
-rw-r--r--editor/debugger/script_editor_debugger.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp
index 6bc1536cb9..622ad00502 100644
--- a/editor/debugger/script_editor_debugger.cpp
+++ b/editor/debugger/script_editor_debugger.cpp
@@ -1563,8 +1563,22 @@ void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) {
ti = ti->get_parent();
}
- // We only need the first child here (C++ source stack trace).
+ // Find the child with the "C++ Source".
+ // It's not at a fixed position as "C++ Error" may come first.
TreeItem *ci = ti->get_first_child();
+ const String cpp_source = "<" + TTR("C++ Source") + ">";
+ while (ci) {
+ if (ci->get_text(0) == cpp_source) {
+ break;
+ }
+ ci = ci->get_next();
+ }
+
+ if (!ci) {
+ WARN_PRINT_ED("No C++ source reference is available for this error.");
+ return;
+ }
+
// Parse back the `file:line @ method()` string.
const Vector<String> file_line_number = ci->get_text(1).split("@")[0].strip_edges().split(":");
ERR_FAIL_COND_MSG(file_line_number.size() < 2, "Incorrect C++ source stack trace file:line format (please report).");