Commit bb77afc1 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

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).
parent 6a3a062d
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment