Fix potential crash if maybe_add_text() fails.
[dcpomatic.git] / src / lib / reel_writer.cc
index a927770a5858e55698dc83a86df8787f2860475f..c4df58fe70830c0e362b32a5465fe8d1eb3f5788 100644 (file)
@@ -602,8 +602,10 @@ ReelWriter::create_reel (list<ReferencedReelAsset> const & refs, list<shared_ptr
                shared_ptr<dcp::ReelClosedCaptionAsset> a = maybe_add_text<dcp::ReelClosedCaptionAsset> (
                        i->second, reel_picture_asset->actual_duration(), reel, refs, fonts, _film, _period
                        );
-               a->set_annotation_text (i->first.name);
-               a->set_language (i->first.language);
+               if (a) {
+                       a->set_annotation_text (i->first.name);
+                       a->set_language (i->first.language);
+               }
        }
 
        Film::Markers markers = _film->markers ();