image: Check for an error surface before dereferencing the backend

As the surface->backend will be NULL in such an error surface, and we
may be legitimately doing boundary checks to reject the error surface.
The alternative would be to set an explicit error surface backend.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54664
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-09-08 15:12:58 +01:00
parent b0c466e27a
commit 558f0a5ab4

View file

@ -73,7 +73,8 @@ _cairo_image_surface_is_clone (cairo_image_surface_t *image)
static inline cairo_bool_t
_cairo_surface_is_image (const cairo_surface_t *surface)
{
return surface->backend->type == CAIRO_SURFACE_TYPE_IMAGE;
/* _cairo_surface_nil sets a NULL backend so be safe */
return surface->backend && surface->backend->type == CAIRO_SURFACE_TYPE_IMAGE;
}
/**