[f-spot] Avoid a couple of NREs.



commit 482b5ecf4fd86ed89957d34af197e9c2be727bc9
Author: Ruben Vermeersch <ruben savanne be>
Date:   Sat Aug 7 22:16:58 2010 +0200

    Avoid a couple of NREs.
    
    This helps it get through a nice collection of broken images. One stop
    closer to being solid like a rock.

 src/TagSelectionWidget.cs |    5 +++++
 src/Widgets/IconView.cs   |   12 ++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/TagSelectionWidget.cs b/src/TagSelectionWidget.cs
index e096833..e39c3e1 100644
--- a/src/TagSelectionWidget.cs
+++ b/src/TagSelectionWidget.cs
@@ -176,6 +176,9 @@ namespace FSpot {
 			Model.GetValue (iter, IdColumn, ref value);
 			uint tag_id = (uint) value;
 			Tag tag = tag_store.Get (tag_id) as Tag;
+
+			if (tag == null)
+				return;
 	
 			SetBackground (renderer, tag);
 	
@@ -206,6 +209,8 @@ namespace FSpot {
 			uint tag_id = (uint) value;
 	
 			Tag tag = tag_store.Get (tag_id) as Tag;
+			if (tag == null)
+				return;
 	
 			SetBackground (renderer, tag);
 	
diff --git a/src/Widgets/IconView.cs b/src/Widgets/IconView.cs
index fa92e69..92a8f90 100644
--- a/src/Widgets/IconView.cs
+++ b/src/Widgets/IconView.cs
@@ -976,10 +976,14 @@ namespace FSpot.Widgets
 			Gdk.Rectangle layout_bounds = Gdk.Rectangle.Zero;
 			if (DisplayDates) {
 				string date;
-				if (cell_width > 200) {
-					date = photo.Time.ToString ();
-				} else {
-					date = photo.Time.ToShortDateString ();
+				try { 
+					if (cell_width > 200) {
+						date = photo.Time.ToString ();
+					} else {
+						date = photo.Time.ToShortDateString ();
+					}
+				} catch (Exception) {
+					date = String.Empty;
 				}
 
 				Pango.Layout layout = (Pango.Layout)date_layouts [date];



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