[f-spot] Fixed a crash when selecting certain images



commit 347bf23330163d03f966eeafeee85698c9305650
Author: Stephen Shaw <sshaw decriptor com>
Date:   Mon Dec 5 23:30:52 2011 -0700

    Fixed a crash when selecting certain images
    
    If the metadata wasn't set correctly on some
    images and when selecting these images in the
    browser the size label would crash.
    
    It was trying to use uninitialized values for
    width and height

 src/Clients/MainApp/FSpot.Widgets/InfoBox.cs |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/Clients/MainApp/FSpot.Widgets/InfoBox.cs b/src/Clients/MainApp/FSpot.Widgets/InfoBox.cs
index 42488c4..7ea7307 100644
--- a/src/Clients/MainApp/FSpot.Widgets/InfoBox.cs
+++ b/src/Clients/MainApp/FSpot.Widgets/InfoBox.cs
@@ -392,9 +392,13 @@ namespace FSpot.Widgets
 
             AddLabelEntry ("size", Catalog.GetString ("Size"), Catalog.GetString ("Show Size"),
                            (photo, metadata) => {
-                                int width = metadata.Properties.PhotoWidth;
-                                int height = metadata.Properties.PhotoHeight;
-                
+				int width = 0;
+				int height = 0;
+				if (null != metadata.Properties) {
+   	                             width = metadata.Properties.PhotoWidth;
+   	                             height = metadata.Properties.PhotoHeight;
+				}
+
                                 if (width != 0 && height != 0)
                                     return String.Format ("{0}x{1}", width, height);
                                 else
@@ -669,8 +673,7 @@ namespace FSpot.Widgets
 
         }
 
-        // Constructor.
-
+		#region Constructor
         public InfoBox () : base(false, 0)
         {
             ContextSwitchStrategy = new MRUInfoBoxContextSwitchStrategy ();
@@ -686,6 +689,7 @@ namespace FSpot.Widgets
             BorderWidth = 2;
             Hide ();
         }
+		#endregion
     }
 
     // Decides whether infobox / histogram should be shown for each context. Implemented



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