[f-spot] Fix crash of ImportController for externl drives without a ThemedIcon



commit 2d40113d19ac132604b1a335d13c09a4eb6c1f9f
Author: Mike Gemünde <mike gemuende de>
Date:   Sun Jun 20 11:43:46 2010 +0200

    Fix crash of ImportController for externl drives without a ThemedIcon
    
    https://bugzilla.gnome.org/show_bug.cgi?id=622164

 src/Import/ImportController.cs |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/Import/ImportController.cs b/src/Import/ImportController.cs
index 73e9b53..9faceab 100644
--- a/src/Import/ImportController.cs
+++ b/src/Import/ImportController.cs
@@ -82,12 +82,17 @@ namespace FSpot.Import
 
         List<ImportSource> ScanSources ()
         {
-		    var monitor = GLib.VolumeMonitor.Default;
+            var monitor = GLib.VolumeMonitor.Default;
             var sources = new List<ImportSource> ();
             foreach (var mount in monitor.Mounts) {
                 var root = new SafeUri (mount.Root.Uri, true);
-                var icon = (mount.Icon as GLib.ThemedIcon).Names [0];
-                sources.Add (new FileImportSource (root, mount.Name, icon));
+
+                var themed_icon = (mount.Icon as GLib.ThemedIcon);
+                if (themed_icon != null && themed_icon.Names.Length > 0) {
+                    sources.Add (new FileImportSource (root, mount.Name, themed_icon.Names [0]));
+                } else {
+                    sources.Add (new FileImportSource (root, mount.Name, null));
+                }
             }
             return sources;
         }



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