From 2d016e7e6ab0bbe4b4ac765093ce607668c991bd Mon Sep 17 00:00:00 2001 From: Hampton Maxwell Date: Thu, 3 Jan 2019 22:02:58 -0800 Subject: [PATCH] Fix Array Out of Bounds crash if no video tracks present --- .../com/brentvatne/exoplayer/ReactExoplayerView.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 27aaf3b7..64c8a404 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -889,11 +889,13 @@ class ReactExoplayerView extends FrameLayout implements } if (groupIndex == C.INDEX_UNSET && trackType == C.TRACK_TYPE_VIDEO) { // Video auto - TrackGroup group = groups.get(0); - tracks = new int[group.length]; - groupIndex = 0; - for (int j = 0; j < group.length; j++) { - tracks[j] = j; + if (groups.length != 0) { + TrackGroup group = groups.get(0); + tracks = new int[group.length]; + groupIndex = 0; + for (int j = 0; j < group.length; j++) { + tracks[j] = j; + } } } else if (groupIndex == C.INDEX_UNSET) { trackSelector.setParameters(disableParameters);