From f923b58f88e43c09c45ffd155a71d3eb8349bf22 Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Tue, 30 Jan 2024 17:35:46 +0100 Subject: [PATCH] Correctly handle failures to open a project --- editor/project_manager.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index f0583c36277..ffb482d103a 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -474,12 +474,12 @@ void ProjectManager::_open_selected_projects() { loading_label->show(); const HashSet &selected_list = project_list->get_selected_project_keys(); - for (const String &path : selected_list) { String conf = path.path_join("project.godot"); if (!FileAccess::exists(conf)) { - _show_error(vformat(TTR("Can't open project at '%s'."), path)); + loading_label->hide(); + _show_error(vformat(TTR("Can't open project at '%s'.\nProject file doesn't exist or is inaccessible."), path)); return; } @@ -497,7 +497,12 @@ void ProjectManager::_open_selected_projects() { args.push_back("--editor"); Error err = OS::get_singleton()->create_instance(args); - ERR_FAIL_COND(err); + if (err != OK) { + loading_label->hide(); + _show_error(vformat(TTR("Can't open project at '%s'.\nFailed to start the editor."), path)); + ERR_PRINT(vformat("Failed to start an editor instance for the project at '%s', error code %d.", path, err)); + return; + } } project_list->project_opening_initiated = true; @@ -508,7 +513,6 @@ void ProjectManager::_open_selected_projects() { void ProjectManager::_open_selected_projects_ask() { const HashSet &selected_list = project_list->get_selected_project_keys(); - if (selected_list.size() < 1) { return; }