[gnome-books/wip/hadess/fix-no-pixbuf-crash] nav-bar: Fix possible crash when there's no pixbuf loader



commit 497fcd67d1335f8be0ea2192c2e8cca44a83dd8e
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Aug 2 16:13:18 2019 +0200

    nav-bar: Fix possible crash when there's no pixbuf loader
    
    If the system is badly configured and there's no pixbuf loader plugin
    available (and the system otherwise advertises it does have one
    available) then don't crash if the NULL pixbuf couldn't be transformed
    into a cairo surface.

 src/lib/gd-nav-bar.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/lib/gd-nav-bar.c b/src/lib/gd-nav-bar.c
index ca7e89a5..f9d582d5 100644
--- a/src/lib/gd-nav-bar.c
+++ b/src/lib/gd-nav-bar.c
@@ -268,9 +268,11 @@ thumbnail_job_completed_cb (EvJobThumbnail *job,
         PreviewItem *item;
 
 #ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
-        gint device_scale;
-        device_scale = gtk_widget_get_scale_factor (GTK_WIDGET (self));
-        cairo_surface_set_device_scale (job->thumbnail_surface, device_scale, device_scale);
+        if (job->thumbnail_surface != NULL) {
+                gint device_scale;
+                device_scale = gtk_widget_get_scale_factor (GTK_WIDGET (self));
+                cairo_surface_set_device_scale (job->thumbnail_surface, device_scale, device_scale);
+        }
 #endif
         surface = ev_document_misc_render_thumbnail_surface_with_frame (GTK_WIDGET (self),
                                                                         job->thumbnail_surface,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]