summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhbina085 <hanif.ariffin.4326@gmail.com>2019-07-14 10:47:24 -0400
committerHanif Bin Ariffin <hanif.ariffin.4326@gmail.com>2019-07-15 09:17:14 -0400
commite9c1e5aa7ce7d4ff82adcac004833718c89560c0 (patch)
tree8a01fadc9a7b6ffebbec6056bd4accc926e5b47e
parent584ca0f156cec64c259382895e105cf27566a987 (diff)
Fix crash when changing Node type
Prevent the application from crashing by simply checking if current "selection" is not null before accessing it. Fixes #30493
-rw-r--r--editor/scene_tree_dock.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 935946bf24..c43d164078 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -394,7 +394,11 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
if (!profile_allow_editing) {
break;
}
- create_dialog->popup_create(false, true, scene_tree->get_selected()->get_class());
+
+ Node *selected = scene_tree->get_selected();
+ if (selected)
+ create_dialog->popup_create(false, true, selected->get_class());
+
} break;
case TOOL_ATTACH_SCRIPT: {