Merge pull request #1413 from react-native-community/bugfix/no-video-out-of-bounds

Fix Array Out of Bounds crash if no video tracks present
This commit is contained in:
Hampton Maxwell 2019-01-03 22:12:12 -08:00 committed by GitHub
commit fd90167f31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -889,11 +889,13 @@ class ReactExoplayerView extends FrameLayout implements
} }
if (groupIndex == C.INDEX_UNSET && trackType == C.TRACK_TYPE_VIDEO) { // Video auto if (groupIndex == C.INDEX_UNSET && trackType == C.TRACK_TYPE_VIDEO) { // Video auto
TrackGroup group = groups.get(0); if (groups.length != 0) {
tracks = new int[group.length]; TrackGroup group = groups.get(0);
groupIndex = 0; tracks = new int[group.length];
for (int j = 0; j < group.length; j++) { groupIndex = 0;
tracks[j] = j; for (int j = 0; j < group.length; j++) {
tracks[j] = j;
}
} }
} else if (groupIndex == C.INDEX_UNSET) { } else if (groupIndex == C.INDEX_UNSET) {
trackSelector.setParameters(disableParameters); trackSelector.setParameters(disableParameters);