From: Krzysztof KosiƄski Date: Sun, 21 Nov 2010 12:09:32 +0000 (+0100) Subject: Fix crash when floating dialog icon is not found X-Git-Url: https://git.tokkee.org/?p=inkscape.git;a=commitdiff_plain;h=c1156e043a8df3fbd660d0353bcfb573a2f6c4d8 Fix crash when floating dialog icon is not found --- diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index 026eac8e0..7b24c00cd 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -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); }