app/core: Only restrict palette for indexed images

Moves gimp_palette_restrict_format () call to after check for
private->palette not being NULL, so it doesn't run for
RGB/Grayscale images.
This commit is contained in:
Alx Sa 2024-10-05 18:57:06 +00:00 committed by Jehan
parent bf513fac4d
commit ec80baf414
1 changed files with 2 additions and 2 deletions

View File

@ -162,8 +162,6 @@ gimp_image_colormap_update_formats (GimpImage *image)
&private->babl_palette_rgba);
format = gimp_babl_format (GIMP_RGB, private->precision, FALSE, space),
gimp_palette_restrict_format (private->palette, format, FALSE);
g_free (format_name);
if (private->palette && gimp_palette_get_n_colors (private->palette) > 0)
@ -171,6 +169,8 @@ gimp_image_colormap_update_formats (GimpImage *image)
guchar *colormap;
gint n_colors;
gimp_palette_restrict_format (private->palette, format, FALSE);
colormap = _gimp_image_get_colormap (image, &n_colors);
g_return_if_fail (colormap != NULL);