mirror of https://github.com/GNOME/gimp.git
fixed potential crash based on a patch from David Gowers (bug #347593).
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).
This commit is contained in:
parent
6a3a062dd9
commit
bb77afc127
|
@ -1,3 +1,9 @@
|
|||
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).
|
||||
|
||||
2006-07-18 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* tools/pdbgen/pdb/image.pdb: fixed docs for gimp-image-add-layer
|
||||
|
|
|
@ -556,7 +556,7 @@ gimp_palette_editor_get_index (GimpPaletteEditor *editor,
|
|||
|
||||
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
|
||||
|
||||
if (! palette)
|
||||
if (! palette || palette->n_colors == 0)
|
||||
return -1;
|
||||
|
||||
if (editor->color)
|
||||
|
@ -597,7 +597,7 @@ gimp_palette_editor_set_index (GimpPaletteEditor *editor,
|
|||
|
||||
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
|
||||
|
||||
if (! palette)
|
||||
if (! palette || palette->n_colors == 0)
|
||||
return FALSE;
|
||||
|
||||
index = CLAMP (index, 0, palette->n_colors - 1);
|
||||
|
@ -622,10 +622,10 @@ gimp_palette_editor_max_index (GimpPaletteEditor *editor)
|
|||
|
||||
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
|
||||
|
||||
if (! palette)
|
||||
if (! palette || palette->n_colors == 0)
|
||||
return -1;
|
||||
|
||||
return MAX (0, palette->n_colors - 1);
|
||||
return palette->n_colors - 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue