plug-ins: Fix crash when exporting indexed ICNS images

Resolves #12880
Same problem as in 4cd3360d, just applied to exported ICNS icons instead.
This commit is contained in:
Alx Sa 2025-03-15 04:26:14 +00:00
parent a034283cb0
commit a723fe27b3

View file

@ -563,6 +563,10 @@ icns_export_image (GFile *file,
/* TODO: Use GimpExportOptions for this when available */ /* TODO: Use GimpExportOptions for this when available */
temp_image = gimp_image_new (width, height, temp_image = gimp_image_new (width, height,
gimp_image_get_base_type (image)); gimp_image_get_base_type (image));
if (gimp_image_get_base_type (image) == GIMP_INDEXED)
gimp_image_set_palette (temp_image,
gimp_image_get_palette (image));
temp_layer = gimp_layer_new_from_drawable (GIMP_DRAWABLE (iter->data), temp_layer = gimp_layer_new_from_drawable (GIMP_DRAWABLE (iter->data),
temp_image); temp_image);
gimp_image_insert_layer (temp_image, temp_layer, NULL, 0); gimp_image_insert_layer (temp_image, temp_layer, NULL, 0);