From: theadib Date: Wed, 2 Jan 2008 23:06:22 +0000 (+0000) Subject: error checks on surface return values X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=763e261f83dd95775ec4a139e776c7d48e5d7227;p=inkscape.git error checks on surface return values --- diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 1697719d7..3df9dff45 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -694,6 +694,9 @@ CairoRenderContext::setupSurface(double width, double height) case CAIRO_SURFACE_TYPE_PS: surface = cairo_ps_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, width, height); #if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 5, 2)) + if(CAIRO_STATUS_SUCCESS != cairo_surface_status(surface)) { + return FALSE; + } cairo_ps_surface_restrict_to_level (surface, (cairo_ps_level_t)_ps_level); #endif break; @@ -722,6 +725,13 @@ CairoRenderContext::setSurfaceTarget(cairo_surface_t *surface, bool is_vector) bool CairoRenderContext::_finishSurfaceSetup(cairo_surface_t *surface) { + if(surface == NULL) { + return FALSE; + } + if(CAIRO_STATUS_SUCCESS != cairo_surface_status(surface)) { + return FALSE; + } + _cr = cairo_create(surface); _surface = surface;