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 a927770..c4df58f 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 ();