Code

attempt at fixing [ 1679218 ] open/import clicking on a 0 byte image results in a...
authorjohanengelen <johanengelen@users.sourceforge.net>
Thu, 8 Nov 2007 00:44:47 +0000 (00:44 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Thu, 8 Nov 2007 00:44:47 +0000 (00:44 +0000)
src/ui/dialog/filedialogimpl-gtkmm.cpp

index 6ad7179383abfd59df45d4311be59953a7c42b26..ecedd8b8f826ad23d1b8caf0763afccececf0310 100644 (file)
@@ -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<Gdk::Pixbuf> img = Gdk::Pixbuf::create_from_file(fileName);
+    Glib::RefPtr<Gdk::Pixbuf> 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();