]> www.fi.muni.cz Git - evince.git/commitdiff
libdocument: Add more sanity checks to ev-document-misc.
authorJosé Aliste <jaliste@src.gnome.org>
Fri, 26 Nov 2010 17:45:46 +0000 (14:45 -0300)
committerJosé Aliste <jaliste@src.gnome.org>
Tue, 30 Nov 2010 14:09:38 +0000 (11:09 -0300)
See bug #572061.

libdocument/ev-document-misc.c

index e710edb8644d4f63995756e774d5522d743415be..f1a309571e9f101b1ce3ffc6cb17023777eeec4b 100644 (file)
@@ -180,6 +180,8 @@ ev_document_misc_surface_from_pixbuf (GdkPixbuf *pixbuf)
        cairo_surface_t *surface;
        cairo_t         *cr;
 
+       g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
+
        surface = cairo_image_surface_create (gdk_pixbuf_get_has_alpha (pixbuf) ?
                                              CAIRO_FORMAT_ARGB32 : CAIRO_FORMAT_RGB24,
                                              gdk_pixbuf_get_width (pixbuf),
@@ -195,6 +197,8 @@ ev_document_misc_surface_from_pixbuf (GdkPixbuf *pixbuf)
 GdkPixbuf *
 ev_document_misc_pixbuf_from_surface (cairo_surface_t *surface)
 {
+       g_return_val_if_fail (surface, NULL);   
+
         return gdk_pixbuf_get_from_surface (surface,
                                             0, 0,
                                             cairo_image_surface_get_width (surface),