Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix out of bounds access when updating current scene #79945

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4975,10 +4975,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() {
Expand Down Expand Up @@ -5387,7 +5384,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();
Expand Down
Loading