add exception handling to Gdk::Pixbuf::create_from_file ()
authorDoug McLain <doug@nostar.net>
Wed, 5 Dec 2007 08:26:41 +0000 (08:26 +0000)
committerDoug McLain <doug@nostar.net>
Wed, 5 Dec 2007 08:26:41 +0000 (08:26 +0000)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2748 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/utils.cc

index 686c8e521c8296c9c3890be3b31a3a69b7039260..8a9325a9409e125f43ff8bf6aa5a98c8a3072a8f 100644 (file)
@@ -583,7 +583,20 @@ get_icon (const char* cname)
                /*NOTREACHED*/
        }
 
-       return Gdk::Pixbuf::create_from_file (path);
+       Glib::RefPtr<Gdk::Pixbuf> img;
+       try {
+               img = Gdk::Pixbuf::create_from_file (path);
+       }
+       catch (const Gdk::PixbufError &e)
+    {
+        cerr << "Caught PixbufError: " << e.what() << endl;
+    }
+    catch (...)
+    {
+        g_message("Caught ... ");
+    }
+
+       return img;
 }
 
 string