From d022543be3b0968c4a6851c120b78b289c156e8e Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 15 Nov 2017 18:17:25 +0100 Subject: Catch Gtk::IconThemeError --- src/ui/widget/dock-item.cpp | 7 ++++++- src/ui/widget/imagetoggler.cpp | 11 +++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index 18ab70eb4..4a06163e1 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -45,7 +45,12 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l int width = 0; int height = 0; Gtk::IconSize::lookup(Gtk::ICON_SIZE_MENU, width, height); - _icon_pixbuf = iconTheme->load_icon(icon_name, width); + try { + _icon_pixbuf = iconTheme->load_icon(icon_name, width); + } + catch (const Gtk::IconThemeError& e) { + std::cerr << "DocItem::DocItem(): " << e.what() << std::endl; + } } if ( _icon_pixbuf ) { diff --git a/src/ui/widget/imagetoggler.cpp b/src/ui/widget/imagetoggler.cpp index a2783ecb1..38c84ca51 100644 --- a/src/ui/widget/imagetoggler.cpp +++ b/src/ui/widget/imagetoggler.cpp @@ -16,6 +16,8 @@ #include "widgets/toolbox.h" #include "ui/icon-names.h" +#include + namespace Inkscape { namespace UI { namespace Widget { @@ -37,8 +39,13 @@ ImageToggler::ImageToggler( char const* on, char const* off) : int phys = width; Glib::RefPtr icon_theme = Gtk::IconTheme::get_default(); - _property_pixbuf_on = icon_theme->load_icon(_pixOnName, phys, (Gtk::IconLookupFlags)0); - _property_pixbuf_off = icon_theme->load_icon(_pixOffName, phys, (Gtk::IconLookupFlags)0); + try { + _property_pixbuf_on = icon_theme->load_icon(_pixOnName, phys, (Gtk::IconLookupFlags)0); + _property_pixbuf_off = icon_theme->load_icon(_pixOffName, phys, (Gtk::IconLookupFlags)0); + } + catch (const Gtk::IconThemeError& e) { + std::cerr << "ImageToggler::ImageToggler(): " << e.what() << std::endl; + } property_pixbuf() = _property_pixbuf_off.get_value(); } -- cgit v1.2.3