Catch attempts to make a DCP when all content has been trimmed to zero length.
[dcpomatic.git] / src / lib / film.cc
index 39dfaf5c0b073b66e4df131a3e4981f30f9d6395..f7fd96a01a35e4f405bb0f575ec9cb161092de03 100644 (file)
@@ -180,7 +180,8 @@ Film::Film (optional<boost::filesystem::path> dir)
                boost::filesystem::path result;
                for (boost::filesystem::path::iterator i = p.begin(); i != p.end(); ++i) {
                        if (*i == "..") {
-                               if (boost::filesystem::is_symlink (result) || result.filename() == "..") {
+                               boost::system::error_code ec;
+                               if (boost::filesystem::is_symlink(result, ec) || result.filename() == "..") {
                                        result /= *i;
                                } else {
                                        result = result.parent_path ();
@@ -319,6 +320,10 @@ Film::make_dcp (bool gui, bool check)
                throw runtime_error (_("You must add some content to the DCP before creating it"));
        }
 
+       if (length() == DCPTime()) {
+               throw runtime_error (_("The DCP is empty, perhaps because all the content has zero length."));
+       }
+
        if (dcp_content_type() == 0) {
                throw MissingSettingError (_("content type"));
        }