summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2023-06-09 18:34:07 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2023-06-09 18:34:07 +0800
commitfade92e4a89aafb1730703fa3f6e5360db9319a6 (patch)
tree8d1ce202c092a47eaea2e5769c20a3bf27cff622
parenta5a23678c4e9bb4e137caf7db1bec8900d91cef3 (diff)
downloadredot-engine-fade92e4a89aafb1730703fa3f6e5360db9319a6.tar.gz
Fix heap-use-after-free when editing project tags
-rw-r--r--editor/project_manager.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 5380d106d3..02f5c21fb4 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -2486,8 +2486,6 @@ void ProjectManager::_delete_project_tag(const String &p_tag) {
}
void ProjectManager::_apply_project_tags() {
- ProjectList::Item &item = _project_list->get_selected_projects().write[0];
-
PackedStringArray tags;
for (int i = 0; i < project_tags->get_child_count(); i++) {
ProjectTag *tag_control = Object::cast_to<ProjectTag>(project_tags->get_child(i));
@@ -2497,7 +2495,7 @@ void ProjectManager::_apply_project_tags() {
}
ConfigFile cfg;
- String project_godot = item.path.path_join("project.godot");
+ const String project_godot = _project_list->get_selected_projects()[0].path.path_join("project.godot");
Error err = cfg.load(project_godot);
if (err != OK) {
tag_edit_error->set_text(vformat(TTR("Couldn't load project at '%s' (error %d). It may be missing or corrupted."), project_godot, err));