mirror of https://github.com/GNOME/gimp.git
pdb: Add check for indexed image to gimp_image_get_colormap ()
The description promises that we return NULL if the image is not in indexed mode, but we didn't actually verify that it was before continuing with the colormap code. This patch adds that verification step.
This commit is contained in:
parent
4ad5760aa9
commit
d8b984a4eb
|
@ -1491,8 +1491,11 @@ image_get_colormap_invoker (GimpProcedure *procedure,
|
|||
guchar *colormap_data;
|
||||
gint n_colors;
|
||||
|
||||
colormap_data = _gimp_image_get_colormap (image, &n_colors);
|
||||
colormap = g_bytes_new_take (colormap_data, 3 * n_colors);
|
||||
if (gimp_image_get_base_type (image) == GIMP_INDEXED)
|
||||
{
|
||||
colormap_data = _gimp_image_get_colormap (image, &n_colors);
|
||||
colormap = g_bytes_new_take (colormap_data, 3 * n_colors);
|
||||
}
|
||||
}
|
||||
|
||||
return_vals = gimp_procedure_get_return_values (procedure, success,
|
||||
|
|
|
@ -1473,8 +1473,11 @@ HELP
|
|||
guchar *colormap_data;
|
||||
gint n_colors;
|
||||
|
||||
colormap_data = _gimp_image_get_colormap (image, &n_colors);
|
||||
colormap = g_bytes_new_take (colormap_data, 3 * n_colors);
|
||||
if (gimp_image_get_base_type (image) == GIMP_INDEXED)
|
||||
{
|
||||
colormap_data = _gimp_image_get_colormap (image, &n_colors);
|
||||
colormap = g_bytes_new_take (colormap_data, 3 * n_colors);
|
||||
}
|
||||
}
|
||||
CODE
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue