[recipes] Fix a crash in the image viewer



commit 7461e97df55981f202f2a55babac1141a7aaf51f
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jan 31 08:00:15 2017 +0100

    Fix a crash in the image viewer
    
    We were crashing when saving a recipe without images. Oops.

 src/gr-image-viewer.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/gr-image-viewer.c b/src/gr-image-viewer.c
index ef77349..d7b5833 100644
--- a/src/gr-image-viewer.c
+++ b/src/gr-image-viewer.c
@@ -650,6 +650,8 @@ void
 gr_image_viewer_show_image (GrImageViewer *viewer,
                             int            idx)
 {
-        viewer->index = idx % viewer->images->len;
-        set_current_image (viewer);
+        if (viewer->images->len > 0) {
+                viewer->index = idx % viewer->images->len;
+                set_current_image (viewer);
+        }
 }


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