diff --git a/ChangeLog b/ChangeLog index b92776b60a..610b192114 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-05-27 Sven Neumann + + * plug-ins/common/png.c (respin_cmap): handle an empty colormap. + Fixes bug #143009. + 2004-05-27 Sven Neumann * libgimpwidgets/gimppickbutton.c: applied patch from Philip diff --git a/plug-ins/common/png.c b/plug-ins/common/png.c index a79785d506..29156f1d2e 100644 --- a/plug-ins/common/png.c +++ b/plug-ins/common/png.c @@ -1471,15 +1471,25 @@ respin_cmap (png_structp pp, GimpDrawable * drawable) { static const guchar trans[] = { 0 }; - gint colors; - guchar *before; - gint transparent; - gint cols, rows; - GimpPixelRgn pixel_rgn; - guchar *pixels; + + gint colors; + guchar *before; + gint transparent; + gint cols, rows; + GimpPixelRgn pixel_rgn; + guchar *pixels; before = gimp_image_get_cmap (image_ID, &colors); + /* + * Make sure there is something in the colormap. + */ + if (colors == 0) + { + before = g_new0 (guchar, 3); + colors = 1; + } + cols = drawable->width; rows = drawable->height;