Hopefully fix crash on new film in some strange cases.
authorCarl Hetherington <cth@carlh.net>
Wed, 18 Dec 2013 10:45:17 +0000 (10:45 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 18 Dec 2013 10:45:17 +0000 (10:45 +0000)
ChangeLog
src/lib/config.cc

index 3e3f258c8ca65fb240895e71103515c57925b657..1f3097c87d1e1fc8a38e8507124cd1481c3597e6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-12-18  Carl Hetherington  <cth@carlh.net>
+
+       * Hopefully fix exception on new film in some strange cases.
+
 2013-12-09  Carl Hetherington  <cth@carlh.net>
 
        * Version 1.42 released.
index 54b9168f2542a1bbd8ee49d0b933f4c95007ada2..ccbcdf7ddb04e5cf08f4a80ca3c1d609545ce556 100644 (file)
@@ -353,7 +353,13 @@ Config::write () const
 boost::filesystem::path
 Config::default_directory_or (boost::filesystem::path a) const
 {
-       if (_default_directory.empty() || !boost::filesystem::exists (_default_directory)) {
+       if (_default_directory.empty()) {
+               return a;
+       }
+
+       boost::system::error_code ec;
+       bool const e = boost::filesystem::exists (_default_directory, ec);
+       if (ec || !e) {
                return a;
        }