Don't crash on startup if the splash PNG can't be found.
authorCarl Hetherington <cth@carlh.net>
Fri, 28 Aug 2015 10:52:02 +0000 (11:52 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 28 Aug 2015 10:52:02 +0000 (11:52 +0100)
src/tools/dcpomatic.cc

index 1ab316fec73a055ae83c2b0354b1220a9dfc0fa3..e2465ea4a250f1d828e6ff3bc4a5ddb79a9f5808 100644 (file)
@@ -798,13 +798,17 @@ private:
                wxInitAllImageHandlers ();
 
                wxSplashScreen* splash = 0;
-               if (!Config::have_existing ()) {
-                       wxBitmap bitmap;
-                       boost::filesystem::path p = shared_path () / "splash.png";
-                       if (bitmap.LoadFile (std_to_wx (p.string ()), wxBITMAP_TYPE_PNG)) {
-                               splash = new wxSplashScreen (bitmap, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT, 0, 0, -1);
-                               wxYield ();
+               try {
+                       if (!Config::have_existing ()) {
+                               wxBitmap bitmap;
+                               boost::filesystem::path p = shared_path () / "splash.png";
+                               if (bitmap.LoadFile (std_to_wx (p.string ()), wxBITMAP_TYPE_PNG)) {
+                                       splash = new wxSplashScreen (bitmap, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT, 0, 0, -1);
+                                       wxYield ();
+                               }
                        }
+               } catch (boost::filesystem::filesystem_error& e) {
+                       /* Maybe we couldn't find the splash image; never mind */
                }
 
                SetAppName (_("DCP-o-matic"));