[gnome-photos] preview-view: Guard against NULL node



commit 5c3cde3e9a63900bd104543e53efea1a18eb99c1
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Jan 22 20:24:26 2015 +0100

    preview-view: Guard against NULL node
    
    Earlier, in GEGL 0.2 gegl_node_get_bounding_box had a guard for NULL
    nodes. It is no longer preset in GEGL git master. This leads to a
    crash if we are ever called with a NULL node, which can happen when we
    are called from the size-allocate handler.
    
    Fixes: https://bugzilla.gnome.org/731437

 src/photos-preview-view.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index c642cd9..7de32c9 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -144,12 +144,16 @@ photos_preview_view_nav_buttons_activated (PhotosPreviewView *self, PhotosPrevie
 static void
 photos_preview_view_scale_and_align_image (PhotosPreviewView *self, GtkWidget *view)
 {
+  PhotosPreviewViewPrivate *priv = self->priv;
   GeglRectangle bbox;
   GtkAllocation alloc;
   float delta_x;
   float delta_y;
   float scale = 1.0;
 
+  if (priv->node == NULL)
+    return;
+
   /* Reset these properties, otherwise values from the previous node
    * will interfere with the current one.
    */
@@ -158,7 +162,7 @@ photos_preview_view_scale_and_align_image (PhotosPreviewView *self, GtkWidget *v
   gegl_gtk_view_set_x (GEGL_GTK_VIEW (view), 0.0);
   gegl_gtk_view_set_y (GEGL_GTK_VIEW (view), 0.0);
 
-  bbox = gegl_node_get_bounding_box (self->priv->node);
+  bbox = gegl_node_get_bounding_box (priv->node);
   gtk_widget_get_allocation (view, &alloc);
 
   if (bbox.width > alloc.width || bbox.height > alloc.height)


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