GNOME Bugzilla – Bug 347593
next/prev color in palette crashes for 0-sized palettes.
Last modified: 2006-07-18 07:45:23 UTC
.. by which I mean, when a palette editor is open and it is editing an empty palette (ie with 0 colors in it), using any of the `context-(palette|swatch)-*-*` actions causes a crash. the attached trivial patch fixes this.
Created attachment 68962 [details] [review] fix (checks for palette->n_colors == 0 as an additional 'failure' condition for the relevant functions.)
Thanks, will apply that as soon as there is a writable gimp repository again ;)
For completeness, shouldn't the patch also check the (pathological and probably impossible) case of indexed images with a zero-length colormap?
If you try that, as follows: # (load an image in) # (open the python console) i = gimp.image_list()[0] i.colormap='' # (use one of the colormap/swatch actions) You will see that in that case, the swatch-* actions default to using the palette editor instead, and the colormap-* actions do nothing. So, already accounted for (unless you can engineer a situation where image colormap is non-NULL when zero-sized -- which would have to involve messing around with image->cmap directly.)
2006-07-18 Sven Neumann <sven@gimp.org> * app/widgets/gimppaletteeditor.c (gimp_palette_editor_get_index, gimp_palette_editor_set_index, gimp_palette_editor_max_index): fixed potential crash based on a patch from David Gowers (bug #347593).