Catch exceptions on loading config.
authorCarl Hetherington <cth@carlh.net>
Tue, 7 May 2013 19:25:36 +0000 (20:25 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 7 May 2013 19:25:36 +0000 (20:25 +0100)
src/lib/config.cc
src/lib/config.h

index b6f464717b48c7f6ca3f5a590c58ca5480d01e22..3beb0aea62327c14bae36e4132344fa61550f0cd 100644 (file)
@@ -61,7 +61,11 @@ Config::Config ()
        _allowed_dcp_frame_rates.push_back (48);
        _allowed_dcp_frame_rates.push_back (50);
        _allowed_dcp_frame_rates.push_back (60);
+}
 
+void
+Config::read ()
+{
        if (!boost::filesystem::exists (file (false))) {
                read_old_metadata ();
                return;
@@ -199,6 +203,13 @@ Config::instance ()
 {
        if (_instance == 0) {
                _instance = new Config;
+               try {
+                       _instance->read ();
+               } catch (...) {
+                       /* configuration load failed; never mind, just
+                          stick with the default.
+                       */
+               }
        }
 
        return _instance;
index 05005e5903d374a97472821976001320351c8133..96aa4e44969d730d1490263b8c094b32d8370dbc 100644 (file)
@@ -213,6 +213,7 @@ public:
 private:
        Config ();
        std::string file (bool) const;
+       void read ();
        void read_old_metadata ();
 
        /** number of threads to use for J2K encoding on the local machine */