From: johanengelen Date: Thu, 8 Nov 2007 00:44:47 +0000 (+0000) Subject: attempt at fixing [ 1679218 ] open/import clicking on a 0 byte image results in a... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9aa7d5dfb857f850aba0ba73560c67604203fa4c;p=inkscape.git attempt at fixing [ 1679218 ] open/import clicking on a 0 byte image results in a crash; but for some reason, exception catching does not work... --- diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index 6ad717938..ecedd8b8f 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -205,7 +205,21 @@ void SVGPreview::showImage(Glib::ustring &theFileName) gint previewHeight = 600; //Get some image info. Smart pointer does not need to be deleted - Glib::RefPtr img = Gdk::Pixbuf::create_from_file(fileName); + Glib::RefPtr img(NULL); + try { + img = Gdk::Pixbuf::create_from_file(fileName); + } + catch (Glib::FileError e) + { + g_message("caught Glib::FileError in SVGPreview::showImage"); + return; + } + catch (Gdk::PixbufError e) + { + g_message("Gdk::PixbufError in SVGPreview::showImage"); + return; + } + gint imgWidth = img->get_width(); gint imgHeight = img->get_height();