From 763e261f83dd95775ec4a139e776c7d48e5d7227 Mon Sep 17 00:00:00 2001 From: theadib Date: Wed, 2 Jan 2008 23:06:22 +0000 Subject: [PATCH] error checks on surface return values --- src/extension/internal/cairo-render-context.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) 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; -- 2.30.2