1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Fix crash on closing empty modified scene

This commit is contained in:
jmb462
2021-03-13 18:19:29 +01:00
parent 942f5f0cb2
commit 49d5ec073f

View File

@@ -2387,11 +2387,14 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
_scene_tab_changed(tab_closing); _scene_tab_changed(tab_closing);
if (unsaved_cache || p_option == FILE_CLOSE_ALL_AND_QUIT || p_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER) { 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(); Node *scene_root = editor_data.get_edited_scene_root(tab_closing);
save_confirmation->get_ok_button()->set_text(TTR("Save & Close")); if (scene_root) {
save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene_filename != "" ? scene_filename : "unsaved scene")); String scene_filename = scene_root->get_filename();
save_confirmation->popup_centered(); save_confirmation->get_ok_button()->set_text(TTR("Save & Close"));
break; 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) { } else if (p_option == FILE_CLOSE) {
tab_closing = editor_data.get_edited_scene(); tab_closing = editor_data.get_edited_scene();