summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-08-26 09:21:21 +0100
committerCarl Hetherington <cth@carlh.net>2016-08-26 09:21:21 +0100
commitde8325fedcbfbd516d91a89be9270299dec49332 (patch)
treee4aebf7cc2c43e4aa10fecfe9d3cb251ad8e2c05 /src
parente02d76fcb78542f487038982bfcc9bb5a935b94e (diff)
Fix exception on new file with no templates.
Diffstat (limited to 'src')
-rw-r--r--src/lib/config.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index 1d9cce64e..872900a73 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -599,6 +599,10 @@ Config::save_template (shared_ptr<const Film> film, string name) const
list<string>
Config::templates () const
{
+ if (!boost::filesystem::exists (path ("templates"))) {
+ return list<string> ();
+ }
+
list<string> n;
for (boost::filesystem::directory_iterator i (path("templates")); i != boost::filesystem::directory_iterator(); ++i) {
n.push_back (i->path().filename().string());