Fix crash when adding subtitles. v2.13.145
authorCarl Hetherington <cth@carlh.net>
Sun, 7 Apr 2019 23:09:00 +0000 (00:09 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 7 Apr 2019 23:09:00 +0000 (00:09 +0100)
src/wx/closed_captions_dialog.cc

index 8e007c3..44e6b8d 100644 (file)
@@ -148,10 +148,11 @@ ClosedCaptionsDialog::update (DCPTime time)
                _current = optional<TextRingBuffers::Data>();
        }
 
-       if (!_current) {
+       if (!_current && !_tracks.empty()) {
                /* We have no current one: get another */
                shared_ptr<Butler> butler = _butler.lock ();
                DCPOMATIC_ASSERT (butler);
+               DCPOMATIC_ASSERT (_track->GetSelection() >= 0);
                DCPOMATIC_ASSERT (_track->GetSelection() < int(_tracks.size()));
                DCPTextTrack track = _tracks[_track->GetSelection()];
                while (true) {