diff options
author | Yuri Sizov <yuris@humnom.net> | 2023-07-31 21:01:43 +0200 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-07-31 21:01:43 +0200 |
commit | fbe7602bd329c9cf4dcbf836e2ad9f81544c2e0a (patch) | |
tree | fb4221b4d8ed55f36a38a13e5efb8372b95b7ab8 | |
parent | f15898161a6e7f186a160ae2c3ced3d075ce0867 (diff) | |
parent | ba2850759d37e6b4f9ba68e0b8e9382b9c3ddf85 (diff) | |
download | redot-engine-fbe7602bd329c9cf4dcbf836e2ad9f81544c2e0a.tar.gz |
Merge pull request #79945 from hvarga/fix-current-scene-update
Fix out of bounds access when updating current scene
-rw-r--r-- | editor/editor_node.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index cbddf6e75b..074dd2ffe0 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4990,10 +4990,7 @@ 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()); - // 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); - } + p_layout->set_value(EDITOR_NODE_CONFIG_SECTION, "current_scene", currently_edited_scene_path); } void EditorNode::save_editor_layout_delayed() { @@ -5402,7 +5399,9 @@ void EditorNode::_load_open_scenes_from_config(Ref<ConfigFile> p_layout) { if (p_layout->has_section_key(EDITOR_NODE_CONFIG_SECTION, "current_scene")) { String current_scene = p_layout->get_value(EDITOR_NODE_CONFIG_SECTION, "current_scene"); int current_scene_idx = scenes.find(current_scene); - set_current_scene(current_scene_idx); + if (current_scene_idx >= 0) { + set_current_scene(current_scene_idx); + } } save_editor_layout_delayed(); |