diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 32442310af4..c205bbd2d83 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2340,11 +2340,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()->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_minsize(); - 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()->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_minsize(); + break; + } } } else if (p_option == FILE_CLOSE) { tab_closing = editor_data.get_edited_scene();