Fix run project when current scene was never saved

This commit is contained in:
Tomasz Chabora 2020-07-23 18:38:32 +02:00
parent f4c17da6f5
commit 9c84e34fd4
1 changed files with 2 additions and 8 deletions

View File

@ -2052,7 +2052,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
String args; String args;
bool skip_breakpoints; bool skip_breakpoints;
if (p_current || (editor_data.get_edited_scene_root() && p_custom == editor_data.get_edited_scene_root()->get_filename())) { if (p_current || (editor_data.get_edited_scene_root() && p_custom != String() && p_custom == editor_data.get_edited_scene_root()->get_filename())) {
Node *scene = editor_data.get_edited_scene_root(); Node *scene = editor_data.get_edited_scene_root();
if (!scene) { if (!scene) {
@ -2082,13 +2082,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
if (unsaved_cache) { if (unsaved_cache) {
Node *scene = editor_data.get_edited_scene_root(); Node *scene = editor_data.get_edited_scene_root();
if (scene) { //only autosave if there is a scene obviously if (scene && scene->get_filename() != "") { // Only autosave if there is a scene and if it has a path.
if (scene->get_filename() == "") {
show_accept(TTR("Current scene was never saved, please save it prior to running."), TTR("OK"));
return;
}
_save_scene_with_preview(scene->get_filename()); _save_scene_with_preview(scene->get_filename());
} }
} }