[f-spot] Try being less fragile in Tiff Date parsing.



commit 489f2eec310afcb222c178e96998f86fadeafbc4
Author: Ruben Vermeersch <ruben savanne be>
Date:   Sun Jun 13 15:19:12 2010 +0200

    Try being less fragile in Tiff Date parsing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=621375

 src/Imaging/Tiff.cs |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/src/Imaging/Tiff.cs b/src/Imaging/Tiff.cs
index 2d8e22e..13b2769 100644
--- a/src/Imaging/Tiff.cs
+++ b/src/Imaging/Tiff.cs
@@ -2040,19 +2040,23 @@ namespace FSpot.Tiff {
 				SubdirectoryEntry sub = (SubdirectoryEntry) this.Header.Directory.Lookup (TagId.ExifIfdPointer);
 				DirectoryEntry e;
 
-				if (sub != null) {
-					e = sub.Directory [0].Lookup (TagId.DateTimeOriginal);
-					
-					if (e != null)
-						return DirectoryEntry.DateTimeFromString (e.StringValue);
-				}
+				try {
+					if (sub != null) {
+						e = sub.Directory [0].Lookup (TagId.DateTimeOriginal);
 
-				e = this.Header.Directory.Lookup (TagId.DateTime);
+						if (e != null)
+							return DirectoryEntry.DateTimeFromString (e.StringValue);
+					}
+
+					e = this.Header.Directory.Lookup (TagId.DateTime);
 
-				if (e != null)
-					return DirectoryEntry.DateTimeFromString (e.StringValue);
-				else
+					if (e != null)
+						return DirectoryEntry.DateTimeFromString (e.StringValue);
+					else
+						return base.Date;
+				} catch (Exception) {
 					return base.Date;
+				}
 			}
 		}
 		



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