@@ -982,9 +982,9 @@ Error EditorExportPlatformIOS::_export_icons(const Ref<EditorExportPreset> &p_pr
982982 }
983983 // Resize main app icon.
984984 icon_path = GLOBAL_GET (" application/config/icon" );
985- Ref<Image> img = memnew (Image) ;
986- Error err = ImageLoader::load_image (icon_path, img );
987- if (err != OK) {
985+ Error err = OK ;
986+ Ref<Image> img = _load_icon_or_splash_image (icon_path, &err );
987+ if (err != OK || img. is_null () || img-> is_empty () ) {
988988 add_message (EXPORT_MESSAGE_ERROR, TTR (" Export Icons" ), vformat (" Invalid icon (%s): '%s'." , info.preset_key , icon_path));
989989 return ERR_UNCONFIGURED;
990990 } else if (info.force_opaque && img->detect_alpha () != Image::ALPHA_NONE) {
@@ -1003,9 +1003,9 @@ Error EditorExportPlatformIOS::_export_icons(const Ref<EditorExportPreset> &p_pr
10031003 }
10041004 } else {
10051005 // Load custom icon and resize if required.
1006- Ref<Image> img = memnew (Image) ;
1007- Error err = ImageLoader::load_image (icon_path, img );
1008- if (err != OK) {
1006+ Error err = OK ;
1007+ Ref<Image> img = _load_icon_or_splash_image (icon_path, &err );
1008+ if (err != OK || img. is_null () || img-> is_empty () ) {
10091009 add_message (EXPORT_MESSAGE_ERROR, TTR (" Export Icons" ), vformat (" Invalid icon (%s): '%s'." , info.preset_key , icon_path));
10101010 return ERR_UNCONFIGURED;
10111011 } else if (info.force_opaque && img->detect_alpha () != Image::ALPHA_NONE) {
@@ -1089,47 +1089,39 @@ Error EditorExportPlatformIOS::_export_loading_screen_file(const Ref<EditorExpor
10891089 const String custom_launch_image_3x = p_preset->get (" storyboard/custom_image@3x" );
10901090
10911091 if (custom_launch_image_2x.length () > 0 && custom_launch_image_3x.length () > 0 ) {
1092- Ref<Image> image;
10931092 String image_path = p_dest_dir.
path_join (
" [email protected] " );
1094- image. instantiate () ;
1095- Error err = ImageLoader::load_image (custom_launch_image_2x, image );
1093+ Error err = OK ;
1094+ Ref<Image> image = _load_icon_or_splash_image (custom_launch_image_2x, &err );
10961095
1097- if (err) {
1098- image.unref ();
1096+ if (err != OK || image.is_null () || image->is_empty ()) {
10991097 return err;
11001098 }
11011099
11021100 if (image->save_png (image_path) != OK) {
11031101 return ERR_FILE_CANT_WRITE;
11041102 }
11051103
1106- image.unref ();
11071104 image_path = p_dest_dir.
path_join (
" [email protected] " );
1108- image.instantiate ();
1109- err = ImageLoader::load_image (custom_launch_image_3x, image);
1105+ image = _load_icon_or_splash_image (custom_launch_image_3x, &err);
11101106
1111- if (err) {
1112- image.unref ();
1107+ if (err != OK || image.is_null () || image->is_empty ()) {
11131108 return err;
11141109 }
11151110
11161111 if (image->save_png (image_path) != OK) {
11171112 return ERR_FILE_CANT_WRITE;
11181113 }
11191114 } else {
1115+ Error err = OK;
11201116 Ref<Image> splash;
11211117
11221118 const String splash_path = GLOBAL_GET (" application/boot_splash/image" );
11231119
11241120 if (!splash_path.is_empty ()) {
1125- splash.instantiate ();
1126- const Error err = ImageLoader::load_image (splash_path, splash);
1127- if (err) {
1128- splash.unref ();
1129- }
1121+ splash = _load_icon_or_splash_image (splash_path, &err);
11301122 }
11311123
1132- if (splash.is_null ()) {
1124+ if (err != OK || splash.is_null () || splash-> is_empty ()) {
11331125 splash.instantiate (boot_splash_png);
11341126 }
11351127
0 commit comments