Commit d1df41a3 by tonihei Committed by Oliver Woodman

Fix window index comparison.

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
parent caa46d49
...@@ -133,6 +133,8 @@ ...@@ -133,6 +133,8 @@
([#4774](https://github.com/google/ExoPlayer/issues/4774)). ([#4774](https://github.com/google/ExoPlayer/issues/4774)).
* Fix issue with audio discontinuities at period transitions, e.g. when * Fix issue with audio discontinuities at period transitions, e.g. when
looping ([#3829](https://github.com/google/ExoPlayer/issues/3829)). 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: * IMA extension:
* Refine the previous fix for empty ad groups to avoid discarding ad breaks * Refine the previous fix for empty ad groups to avoid discarding ad breaks
unnecessarily ([#4030](https://github.com/google/ExoPlayer/issues/4030)), unnecessarily ([#4030](https://github.com/google/ExoPlayer/issues/4030)),
......
...@@ -495,7 +495,7 @@ public final class CastPlayer implements Player { ...@@ -495,7 +495,7 @@ public final class CastPlayer implements Player {
@Override @Override
public @Nullable Object getCurrentTag() { public @Nullable Object getCurrentTag() {
int windowIndex = getCurrentWindowIndex(); int windowIndex = getCurrentWindowIndex();
return windowIndex > currentTimeline.getWindowCount() return windowIndex >= currentTimeline.getWindowCount()
? null ? null
: currentTimeline.getWindow(windowIndex, window, /* setTag= */ true).tag; : currentTimeline.getWindow(windowIndex, window, /* setTag= */ true).tag;
} }
......
...@@ -380,7 +380,7 @@ import java.util.concurrent.CopyOnWriteArraySet; ...@@ -380,7 +380,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
@Override @Override
public @Nullable Object getCurrentTag() { public @Nullable Object getCurrentTag() {
int windowIndex = getCurrentWindowIndex(); int windowIndex = getCurrentWindowIndex();
return windowIndex > playbackInfo.timeline.getWindowCount() return windowIndex >= playbackInfo.timeline.getWindowCount()
? null ? null
: playbackInfo.timeline.getWindow(windowIndex, window, /* setTag= */ true).tag; : playbackInfo.timeline.getWindow(windowIndex, window, /* setTag= */ true).tag;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment