From 9fa643bdebdcb39cca4b529f13fdd0fbfd721d58 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 7 May 2013 20:25:36 +0100 Subject: Catch exceptions on loading config. --- src/lib/config.cc | 11 +++++++++++ src/lib/config.h | 1 + 2 files changed, 12 insertions(+) (limited to 'src/lib') diff --git a/src/lib/config.cc b/src/lib/config.cc index b6f464717..3beb0aea6 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -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; diff --git a/src/lib/config.h b/src/lib/config.h index 05005e590..96aa4e449 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -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 */ -- cgit v1.2.3