Godot Engine – Multi-platform 2D and 3D game engine
Make build profile editor show a toaster for errors when hidden
Michael Alexsander3fc6bfa256b4
diff --git a/editor/settings/editor_build_profile.cpp b/editor/settings/editor_build_profile.cppindex 9aaed6a2309..991c1b3a924 100644--- a/editor/settings/editor_build_profile.cpp+++ b/editor/settings/editor_build_profile.cpp@@ -41,6 +41,7 @@#include "editor/file_system/editor_file_system.h"#include "editor/file_system/editor_paths.h"#include "editor/gui/editor_file_dialog.h"+#include "editor/gui/editor_toaster.h"#include "editor/settings/editor_settings.h"#include "editor/themes/editor_scale.h"#include "scene/gui/line_edit.h"@@ -1356,7 +1357,12 @@ bool EditorBuildProfileManager::_import_profile(const String &p_path) {Error err = profile->load_from_file(p_path);String basefile = p_path.get_file();if (err != OK) {- EditorNode::get_singleton()->show_warning(vformat(TTR("File '%s' format is invalid, import aborted."), basefile));+ // Avoid throwing an error if this is called when the dialog is still hidden, like in the ready notification.+ if (is_visible()) {+ EditorNode::get_singleton()->show_warning(vformat(TTR("File '%s' format is invalid, import aborted."), basefile));+ } else {+ EditorToaster::get_singleton()->popup_str(vformat(TTR("Can't load build profile. File '%s' is invalid."), basefile), EditorToaster::SEVERITY_ERROR);+ }return false;}