[gimp] app: do not feed babl with empty color palette.



commit f13691558d7456891ad2d868762dc3d6e4179eb8
Author: Jehan <jehan girinstud io>
Date:   Mon Mar 14 11:30:29 2022 +0100

    app: do not feed babl with empty color palette.
    
    Since commit 4cf38d784fe, 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.

 app/core/gimpimage-colormap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/app/core/gimpimage-colormap.c b/app/core/gimpimage-colormap.c
index 7843a1235d..e50b1129f5 100644
--- a/app/core/gimpimage-colormap.c
+++ b/app/core/gimpimage-colormap.c
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]