[f-spot] Be sligthly more resilient to metadata parsing failures.



commit 84b2983961f427a4f764dbd747d4a99337923f42
Author: Ruben Vermeersch <ruben savanne be>
Date:   Mon Sep 13 11:06:10 2010 +0200

    Be sligthly more resilient to metadata parsing failures.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=629386

 .../MainApp/FSpot.Import/MetadataImporter.cs       |    3 +++
 src/Core/FSpot.Core/FSpot.Core/FilePhoto.cs        |    8 +++++---
 2 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/Clients/MainApp/FSpot.Import/MetadataImporter.cs b/src/Clients/MainApp/FSpot.Import/MetadataImporter.cs
index f5d8fdc..086603d 100644
--- a/src/Clients/MainApp/FSpot.Import/MetadataImporter.cs
+++ b/src/Clients/MainApp/FSpot.Import/MetadataImporter.cs
@@ -86,6 +86,9 @@ namespace FSpot.Import {
         public bool Import (Photo photo, IPhoto importing_from)
         {
             using (var metadata = Metadata.Parse (importing_from.DefaultVersion.Uri)) {
+                if (metadata == null)
+                    return true;
+
                 // Copy Rating
                 var rating = metadata.ImageTag.Rating;
                 if (rating.HasValue) {
diff --git a/src/Core/FSpot.Core/FSpot.Core/FilePhoto.cs b/src/Core/FSpot.Core/FSpot.Core/FilePhoto.cs
index a5b1515..08ef0e0 100644
--- a/src/Core/FSpot.Core/FSpot.Core/FilePhoto.cs
+++ b/src/Core/FSpot.Core/FSpot.Core/FilePhoto.cs
@@ -36,9 +36,11 @@ namespace FSpot.Core
                 return;
             
             using (var metadata = Metadata.Parse (DefaultVersion.Uri)) {
-                var date = metadata.ImageTag.DateTime;
-                time = date.HasValue ? date.Value : CreateDate;
-                description = metadata.ImageTag.Comment;
+                if (metadata != null) {
+                    var date = metadata.ImageTag.DateTime;
+                    time = date.HasValue ? date.Value : CreateDate;
+                    description = metadata.ImageTag.Comment;
+                }
             }
             
             metadata_parsed = true;



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