app: do not feed babl with empty color palette.

Since commit 4cf38d784f, when loading an indexed image, we would first
initialize a palette with 0 colors, then set it to the right colors.
Babl outputs the following message when initializing to 0 colors:

> ../../src/babl/babl/babl-internal.h:214 babl_log()
>	attempt to create a palette with 0 colors. using default palette instead.

Let's only set the palette to Babl when it has colors.
This commit is contained in:
Jehan 2022-03-14 11:30:29 +01:00
parent e7ef9be000
commit f13691558d
1 changed files with 1 additions and 1 deletions

View File

@ -144,7 +144,7 @@ gimp_image_colormap_update_formats (GimpImage *image)
g_free (format_name);
if (private->palette)
if (private->palette && gimp_palette_get_n_colors (private->palette) > 0)
{
guchar *colormap;
gint n_colors;