From 9aa20986f0777e3022ab73b2a5d1ae2497230b7b Mon Sep 17 00:00:00 2001 From: Marcelo Fernandez Date: Thu, 5 Oct 2017 15:52:57 -0300 Subject: [PATCH] Fix crash when a custom theme can't be loaded --- scene/register_scene_types.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index b9dfbd6bb03..a85a0fb9f76 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -222,13 +222,18 @@ void register_scene_types() { String font_path = GLOBAL_DEF("gui/theme/custom_font", ""); ProjectSettings::get_singleton()->set_custom_property_info("gui/theme/custom_font", PropertyInfo(Variant::STRING, "gui/theme/custom_font", PROPERTY_HINT_FILE, "*.tres,*.res,*.font", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)); + bool has_theme = false; if (theme_path != String()) { Ref theme = ResourceLoader::load(theme_path); if (theme.is_valid()) { Theme::set_default(theme); + has_theme = true; + } else { + ERR_PRINTS("Error loading custom theme '" + theme_path + "'"); } - } else { + } + if (!has_theme) { Ref font; if (font_path != String()) { font = ResourceLoader::load(font_path);