summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-09-23 20:15:35 +0200
committerCarl Hetherington <cth@carlh.net>2020-09-23 20:15:35 +0200
commit206e5213c74c848f0b6dc46f879cabe30a436e51 (patch)
treee6deeddd7752cf7961ec3e17f25c99dec344e2bf /src
parente40f5c5923d72b42d7b1c617a6e459569d584e8c (diff)
Don't fail to write CPL if no content version has been set up.
Diffstat (limited to 'src')
-rw-r--r--src/cpl.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cpl.cc b/src/cpl.cc
index 246ca21a..ead592fd 100644
--- a/src/cpl.cc
+++ b/src/cpl.cc
@@ -185,8 +185,12 @@ CPL::write_xml (boost::filesystem::path file, Standard standard, shared_ptr<cons
root->add_child("Creator")->add_child_text (_creator);
root->add_child("ContentTitleText")->add_child_text (_content_title_text);
root->add_child("ContentKind")->add_child_text (content_kind_to_string (_content_kind));
- DCP_ASSERT (!_content_versions.empty());
- _content_versions[0].as_xml (root);
+ if (_content_versions.empty()) {
+ ContentVersion cv;
+ cv.as_xml (root);
+ } else {
+ _content_versions[0].as_xml (root);
+ }
xmlpp::Element* rating_list = root->add_child("RatingList");
BOOST_FOREACH (Rating i, _ratings) {