Fix issue with seeking before timeline available

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140204054
This commit is contained in:
olly 2016-11-25 08:18:15 -08:00 committed by Oliver Woodman
parent 76c58a34d3
commit ee9b7be2fa

View File

@ -981,9 +981,9 @@ import java.io.IOException;
*/ */
private Pair<Integer, Long> resolveSeekPosition(SeekPosition seekPosition) { private Pair<Integer, Long> resolveSeekPosition(SeekPosition seekPosition) {
Timeline seekTimeline = seekPosition.timeline; Timeline seekTimeline = seekPosition.timeline;
if (seekTimeline == null) { if (seekTimeline.isEmpty()) {
// The application performed a blind seek without a timeline (most likely based on knowledge // The application performed a blind seek without a non-empty timeline (most likely based on
// of what the timeline will be). Use the internal timeline. // knowledge of what the future timeline will be). Use the internal timeline.
seekTimeline = timeline; seekTimeline = timeline;
Assertions.checkIndex(seekPosition.windowIndex, 0, timeline.getWindowCount()); Assertions.checkIndex(seekPosition.windowIndex, 0, timeline.getWindowCount());
} }