diff options
author | Andreas Haas <Hinsbart@users.noreply.github.com> | 2017-10-06 13:11:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-06 13:11:52 +0200 |
commit | 701c77ba29e6df57b37d5715dc9f7029674cd9ae (patch) | |
tree | fbad7e69d8ec4b1d0ac14db7b7980dd168ac88d3 /scene | |
parent | ec2a4da6d6a697830aa1c6a4aedf0299137b39db (diff) | |
parent | 9aa20986f0777e3022ab73b2a5d1ae2497230b7b (diff) |
Merge pull request #11859 from marcelofg55/invalid_customtheme_crashfix
Fix crash when a custom theme can't be loaded
Diffstat (limited to 'scene')
-rw-r--r-- | scene/register_scene_types.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index b9dfbd6bb0..a85a0fb9f7 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> 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> font; if (font_path != String()) { font = ResourceLoader::load(font_path); |