Code

Fix crash when floating dialog icon is not found
authorKrzysztof Kosiński <tweenk.pl@gmail.com>
Sun, 21 Nov 2010 12:09:32 +0000 (13:09 +0100)
committerKrzysztof Kosiński <tweenk.pl@gmail.com>
Sun, 21 Nov 2010 12:09:32 +0000 (13:09 +0100)
src/ui/widget/dock-item.cpp

index 026eac8e08b3b751a72108aa7aac6d85bc696ad1..7b24c00cd61a73b6dac40a9d3f0ae713606d8879 100644 (file)
@@ -44,11 +44,17 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l
     if (!icon_name.empty()) {
         int width = 0, height = 0;
         Gtk::IconSize::lookup(Gtk::ICON_SIZE_MENU, width, height);
-        _icon_pixbuf = Gtk::IconTheme::get_default()->load_icon(icon_name, width, (Gtk::IconLookupFlags) 0);
-        _gdl_dock_item =
-            gdl_dock_item_new_with_pixbuf_icon(name.c_str(), long_name.c_str(),
-                                               _icon_pixbuf->gobj(), gdl_dock_behavior);
-    } else {
+        try {
+            _icon_pixbuf = Gtk::IconTheme::get_default()->load_icon(icon_name, width, (Gtk::IconLookupFlags) 0);
+            _gdl_dock_item =
+                gdl_dock_item_new_with_pixbuf_icon(name.c_str(), long_name.c_str(),
+                                                   _icon_pixbuf->gobj(), gdl_dock_behavior);
+        } catch (Gtk::IconThemeError) {
+            // ignore - create the dock item without an icon below
+        }
+    }
+
+    if (!_gdl_dock_item) {
         _gdl_dock_item =
             gdl_dock_item_new(name.c_str(), long_name.c_str(), gdl_dock_behavior);
     }