FIXME: Remove all use of add_child() from xmlpp.
[dcpomatic.git] / src / lib / string_text_file_content.cc
index dae6811b56120a12f8e576669d5029745872e65e..c6639936c9bbd70cae7867221ba51f9485ab150c 100644 (file)
@@ -122,16 +122,16 @@ StringTextFileContent::technical_summary () const
 
 
 void
-StringTextFileContent::as_xml (xmlpp::Node* node, bool with_paths) const
+StringTextFileContent::as_xml(xmlpp::Element* element, bool with_paths) const
 {
-       node->add_child("Type")->add_child_text("TextSubtitle");
-       Content::as_xml (node, with_paths);
+       cxml::add_text_child(element, "Type", "TextSubtitle");
+       Content::as_xml(element, with_paths);
 
        if (only_text()) {
-               only_text()->as_xml(node);
+               only_text()->as_xml(element);
        }
 
-       node->add_child("Length")->add_child_text(raw_convert<string>(_length.get ()));
+       cxml::add_text_child(element, "Length", raw_convert<string>(_length.get()));
 }
 
 
@@ -189,7 +189,10 @@ StringTextFileContent::check_font_ids()
        auto names = font_names(file);
 
        auto content = only_text();
-       auto legacy_font_file = content->get_font("font")->file();
+       optional<boost::filesystem::path> legacy_font_file;
+       if (auto legacy_font = content->get_font("font")) {
+               legacy_font_file = legacy_font->file();
+       }
 
        for (auto name: names) {
                if (!content->get_font(name)) {