Fix failure to skip through more than one empty reel when looking for a reel to put...
[dcpomatic.git] / src / lib / writer.cc
index d86a2ccf4ab032ba3a6d1f17ca232af7482bd02f..896d59cfcb2d0856e5647887da828a3abd34b616 100644 (file)
@@ -660,8 +660,9 @@ Writer::write (PlayerSubtitles subs, DCPTimePeriod period)
                return;
        }
 
-       if (_subtitle_reel->period().to <= period.from) {
+       while (_subtitle_reel->period().to <= period.from) {
                ++_subtitle_reel;
+               DCPOMATIC_ASSERT (_subtitle_reel != _reels.end());
        }
 
        DCPOMATIC_ASSERT (_subtitle_reel != _reels.end());