Fix potential crash if maybe_add_text() fails.
authorCarl Hetherington <cth@carlh.net>
Thu, 19 Nov 2020 23:40:02 +0000 (00:40 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 20 Nov 2020 22:47:03 +0000 (23:47 +0100)
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 ();