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
This commit is contained in:
hbina085 2019-07-14 10:47:24 -04:00 committed by Hanif Bin Ariffin
parent 584ca0f156
commit e9c1e5aa7c
1 changed files with 5 additions and 1 deletions

View File

@ -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: {