[shotwell] Fix issue with get_metadata returning null



commit 2ad28a6987b1904b02dc9c1e0e414d2bc594a60c
Author: Jens Georg <mail jensge org>
Date:   Sat May 21 16:36:56 2016 +0200

    Fix issue with get_metadata returning null
    
    In DirectPhoto, do not assume that get_metadata() will succeed (it is actually
    declared nullable). Prevents several criticals later on

 src/direct/DirectPhoto.vala |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/direct/DirectPhoto.vala b/src/direct/DirectPhoto.vala
index ea8f42d..4016ee2 100644
--- a/src/direct/DirectPhoto.vala
+++ b/src/direct/DirectPhoto.vala
@@ -121,8 +121,10 @@ public class DirectPhoto : Photo {
     }
 
     public override Gdk.Pixbuf? get_thumbnail(int scale) throws Error {
-        return (get_metadata().get_preview_count() == 0) ? null :
-            get_orientation().rotate_pixbuf(get_metadata().get_preview(0).get_pixbuf());
+        var metadata = get_metadata();
+
+        return (metadata == null || metadata.get_preview_count() == 0) ? null :
+            get_orientation().rotate_pixbuf(metadata.get_preview(0).get_pixbuf());
     }
 
     protected override void notify_altered(Alteration alteration) {


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