diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-03-14 01:04:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-14 01:04:32 +0100 |
commit | df4019c0dab46659588089f6e19c5cea0034817a (patch) | |
tree | 7804da00067ccfb9111d795c687b1a3a1151f3c7 | |
parent | 1066dbceccd8c7e338cf9792286f3acb3e8643ce (diff) | |
parent | 49d5ec073f47366e69521cea218e57c10f234aa2 (diff) |
Merge pull request #46970 from jmb462/fix-crash-on-closing-empty-modified-scene
Fix crash on closing empty modified scene (Fix #46959)
-rw-r--r-- | editor/editor_node.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index f0e53e7ef5..4c23ada5e9 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2387,11 +2387,14 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { _scene_tab_changed(tab_closing); if (unsaved_cache || p_option == FILE_CLOSE_ALL_AND_QUIT || p_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER) { - String scene_filename = editor_data.get_edited_scene_root(tab_closing)->get_filename(); - save_confirmation->get_ok_button()->set_text(TTR("Save & Close")); - save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene_filename != "" ? scene_filename : "unsaved scene")); - save_confirmation->popup_centered(); - break; + Node *scene_root = editor_data.get_edited_scene_root(tab_closing); + if (scene_root) { + String scene_filename = scene_root->get_filename(); + save_confirmation->get_ok_button()->set_text(TTR("Save & Close")); + save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene_filename != "" ? scene_filename : "unsaved scene")); + save_confirmation->popup_centered(); + break; + } } } else if (p_option == FILE_CLOSE) { tab_closing = editor_data.get_edited_scene(); |