From e0742be4db844fd06ec6c0e99924a0f826e989d5 Mon Sep 17 00:00:00 2001 From: Hristo Stamenov Date: Wed, 6 Jul 2022 16:19:46 +0300 Subject: Double check the selected tree item on error activated and error selected callbacks as the value might be nullptr which would cause a crash. --- editor/debugger/script_editor_debugger.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'editor/debugger') diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 408d6af022..f8b82ecc51 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -1422,6 +1422,10 @@ bool ScriptEditorDebugger::is_skip_breakpoints() { void ScriptEditorDebugger::_error_activated() { TreeItem *selected = error_tree->get_selected(); + if (!selected) { + return; + } + TreeItem *ci = selected->get_first_child(); if (ci) { selected->set_collapsed(!selected->is_collapsed()); @@ -1430,6 +1434,11 @@ void ScriptEditorDebugger::_error_activated() { void ScriptEditorDebugger::_error_selected() { TreeItem *selected = error_tree->get_selected(); + + if (!selected) { + return; + } + Array meta = selected->get_metadata(0); if (meta.size() == 0) { return; -- cgit v1.2.3