Skip to content

Commit

Permalink
Fix window index comparison.
Browse files Browse the repository at this point in the history
To check the validity of a window index it needs to be compared with a greater
or equal sign to the window count.

Issue:#4822

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213234403
  • Loading branch information
tonihei authored and ojw28 committed Sep 17, 2018
1 parent caa46d4 commit d1df41a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@
([#4774](https://github.com/google/ExoPlayer/issues/4774)).
* Fix issue with audio discontinuities at period transitions, e.g. when
looping ([#3829](https://github.com/google/ExoPlayer/issues/3829)).
* Fix issue where `player.getCurrentTag()` throws an `IndexOutOfBoundsException`
([#4822](https://github.com/google/ExoPlayer/issues/4822)).
* IMA extension:
* Refine the previous fix for empty ad groups to avoid discarding ad breaks
unnecessarily ([#4030](https://github.com/google/ExoPlayer/issues/4030)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ public int getPreviousWindowIndex() {
@Override
public @Nullable Object getCurrentTag() {
int windowIndex = getCurrentWindowIndex();
return windowIndex > currentTimeline.getWindowCount()
return windowIndex >= currentTimeline.getWindowCount()
? null
: currentTimeline.getWindow(windowIndex, window, /* setTag= */ true).tag;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public SeekParameters getSeekParameters() {
@Override
public @Nullable Object getCurrentTag() {
int windowIndex = getCurrentWindowIndex();
return windowIndex > playbackInfo.timeline.getWindowCount()
return windowIndex >= playbackInfo.timeline.getWindowCount()
? null
: playbackInfo.timeline.getWindow(windowIndex, window, /* setTag= */ true).tag;
}
Expand Down

0 comments on commit d1df41a

Please sign in to comment.