file-data: Prevent crash with GIH and empty groups
Empty layer groups have no dimensions, which can cause the GIH exporter to crash when splitting cells (as it produces negative width & height dimensions). To prevent this, this patch initializes potential brushes to NULL, verifies the dimensions are positive before trying to create GimpTempBuf with then, and prevents a possible NULL brush from being added to the exported brush list.
This commit is contained in:
parent
413b24b0d4
commit
5b6f1b481a
2 changed files with 6 additions and 2 deletions
|
|
@ -275,6 +275,9 @@ file_gbr_drawable_to_brush (GimpDrawable *drawable,
|
|||
width = rect->width;
|
||||
height = rect->height;
|
||||
|
||||
if (width < 0 || height < 0)
|
||||
return NULL;
|
||||
|
||||
brush = g_object_new (GIMP_TYPE_BRUSH,
|
||||
"name", name,
|
||||
"mime-type", "image/x-gimp-gbr",
|
||||
|
|
@ -421,7 +424,7 @@ file_gbr_image_to_brush (GimpImage *image,
|
|||
const gchar *name,
|
||||
gdouble spacing)
|
||||
{
|
||||
GimpBrush *brush;
|
||||
GimpBrush *brush = NULL;
|
||||
GimpImage *subimage = NULL;
|
||||
GimpDrawable *drawable;
|
||||
gint width;
|
||||
|
|
|
|||
|
|
@ -346,7 +346,8 @@ file_gih_image_to_pipe (GimpImage *image,
|
|||
gimp_object_get_name (layer),
|
||||
spacing);
|
||||
|
||||
brushes = g_list_prepend (brushes, brush);
|
||||
if (brush)
|
||||
brushes = g_list_prepend (brushes, brush);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue