diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/register_scene_types.cpp | 12 | ||||
-rw-r--r-- | scene/resources/resource_format_text.cpp | 6 |
2 files changed, 12 insertions, 6 deletions
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 47b8b6073b..996d249bbf 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -372,7 +372,11 @@ void register_scene_types() { OS::get_singleton()->yield(); //may take time to init - AcceptDialog::set_swap_cancel_ok(GLOBAL_DEF_NOVAL("gui/common/swap_cancel_ok", bool(DisplayServer::get_singleton()->get_swap_cancel_ok()))); + bool swap_cancel_ok = false; + if (DisplayServer::get_singleton()) { + swap_cancel_ok = GLOBAL_DEF_NOVAL("gui/common/swap_cancel_ok", bool(DisplayServer::get_singleton()->get_swap_cancel_ok())); + } + AcceptDialog::set_swap_cancel_ok(swap_cancel_ok); #endif /* REGISTER 3D */ @@ -912,8 +916,10 @@ void register_scene_types() { } } - // Always make the default theme to avoid invalid default font/icon/style in the given theme - make_default_theme(default_theme_hidpi, font); + // Always make the default theme to avoid invalid default font/icon/style in the given theme. + if (RenderingServer::get_singleton()) { + make_default_theme(default_theme_hidpi, font); + } if (theme_path != String()) { Ref<Theme> theme = ResourceLoader::load(theme_path); diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 93db8b725f..d4d8018d43 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -572,7 +572,7 @@ Error ResourceLoaderText::load() { } } - if (progress) { + if (progress && resources_total > 0) { *progress = resource_current / float(resources_total); } } @@ -640,7 +640,7 @@ Error ResourceLoaderText::load() { return error; } else { error = OK; - if (progress) { + if (progress && resources_total > 0) { *progress = resource_current / float(resources_total); } @@ -674,7 +674,7 @@ Error ResourceLoaderText::load() { resource_current++; - if (progress) { + if (progress && resources_total > 0) { *progress = resource_current / float(resources_total); } |