瀏覽代碼

Merge pull request #78152 from brno32/editor-persistence-empty-scene-fix

Prevent non-existent scene from being saved to persistent editor config
Rémi Verschelde 2 年之前
父節點
當前提交
a5206e449e
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      editor/editor_node.cpp

+ 4 - 1
editor/editor_node.cpp

@@ -4932,7 +4932,10 @@ void EditorNode::_save_open_scenes_to_config(Ref<ConfigFile> p_layout) {
 	p_layout->set_value(EDITOR_NODE_CONFIG_SECTION, "open_scenes", scenes);
 
 	String currently_edited_scene_path = editor_data.get_scene_path(editor_data.get_edited_scene());
-	p_layout->set_value(EDITOR_NODE_CONFIG_SECTION, "current_scene", currently_edited_scene_path);
+	// Don't save a bad path to the config.
+	if (!currently_edited_scene_path.is_empty()) {
+		p_layout->set_value(EDITOR_NODE_CONFIG_SECTION, "current_scene", currently_edited_scene_path);
+	}
 }
 
 void EditorNode::save_editor_layout_delayed() {