diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-03-05 14:37:15 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-03-05 14:39:11 +0100 |
commit | e63de52bdba895266726b988d8158cfb573bc8b8 (patch) | |
tree | 57ea18866ff2480df4a386fa4536f6dd7a76de39 /main | |
parent | 7d80635fce1d0c44fa69d4d8cf3da40fa998f9c7 (diff) | |
download | redot-engine-e63de52bdba895266726b988d8158cfb573bc8b8.tar.gz |
Check if DisplayServer supports icons before attempting setting it
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/main/main.cpp b/main/main.cpp index 91ccbe6766..ec66d47901 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -2885,7 +2885,7 @@ Error Main::setup2() { } #if defined(TOOLS_ENABLED) && defined(MACOS_ENABLED) - if (OS::get_singleton()->get_bundle_icon_path().is_empty()) { + if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_ICON) && OS::get_singleton()->get_bundle_icon_path().is_empty()) { Ref<Image> icon = memnew(Image(app_icon_png)); DisplayServer::get_singleton()->set_icon(icon); } @@ -3802,7 +3802,7 @@ bool Main::start() { #ifdef MACOS_ENABLED String mac_icon_path = GLOBAL_GET("application/config/macos_native_icon"); - if (!mac_icon_path.is_empty()) { + if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_NATIVE_ICON) && !mac_icon_path.is_empty()) { DisplayServer::get_singleton()->set_native_icon(mac_icon_path); has_icon = true; } @@ -3810,14 +3810,14 @@ bool Main::start() { #ifdef WINDOWS_ENABLED String win_icon_path = GLOBAL_GET("application/config/windows_native_icon"); - if (!win_icon_path.is_empty()) { + if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_NATIVE_ICON) && !win_icon_path.is_empty()) { DisplayServer::get_singleton()->set_native_icon(win_icon_path); has_icon = true; } #endif String icon_path = GLOBAL_GET("application/config/icon"); - if ((!icon_path.is_empty()) && (!has_icon)) { + if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_ICON) && !icon_path.is_empty() && !has_icon) { Ref<Image> icon; icon.instantiate(); if (ImageLoader::load_image(icon_path, icon) == OK) { @@ -3850,7 +3850,7 @@ bool Main::start() { #endif } - if (!has_icon && OS::get_singleton()->get_bundle_icon_path().is_empty()) { + if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_ICON) && !has_icon && OS::get_singleton()->get_bundle_icon_path().is_empty()) { Ref<Image> icon = memnew(Image(app_icon_png)); DisplayServer::get_singleton()->set_icon(icon); } |