[gnome-photos] preview-nav-buttons: Assert that we have an active item when navigating



commit 192c64228609351564f285abb14380f7b9e57381
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Dec 6 12:11:52 2016 +0100

    preview-nav-buttons: Assert that we have an active item when navigating

 src/photos-preview-nav-buttons.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-preview-nav-buttons.c b/src/photos-preview-nav-buttons.c
index aaf61ba..6b35d7b 100644
--- a/src/photos-preview-nav-buttons.c
+++ b/src/photos-preview-nav-buttons.c
@@ -333,10 +333,14 @@ static void
 photos_preview_nav_buttons_next (PhotosPreviewNavButtons *self)
 {
   GtkTreePath *current_path;
+  PhotosBaseItem *item;
 
   if (!self->enable_next)
     return;
 
+  item = PHOTOS_BASE_ITEM (photos_base_manager_get_active_object (self->item_mngr));
+  g_return_if_fail (PHOTOS_IS_BASE_ITEM (item));
+
   g_signal_emit (self, signals[LOAD_NEXT], 0);
 
   current_path = gtk_tree_row_reference_get_path (self->current_row);
@@ -351,10 +355,14 @@ static void
 photos_preview_nav_buttons_previous (PhotosPreviewNavButtons *self)
 {
   GtkTreePath *current_path;
+  PhotosBaseItem *item;
 
   if (!self->enable_prev)
     return;
 
+  item = PHOTOS_BASE_ITEM (photos_base_manager_get_active_object (self->item_mngr));
+  g_return_if_fail (PHOTOS_IS_BASE_ITEM (item));
+
   g_signal_emit (self, signals[LOAD_PREVIOUS], 0);
 
   current_path = gtk_tree_row_reference_get_path (self->current_row);


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