Merge pull request #1233 from react-native-community/bugfix/no-audio-crash

Avoid crash when there are no tracks to choose from
This commit is contained in:
Hampton Maxwell 2018-09-12 19:41:03 -07:00 committed by GitHub
commit 44b626aaaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -830,6 +830,10 @@ class ReactExoplayerView extends FrameLayout implements
}
private int getTrackIndexForDefaultLocale(TrackGroupArray groups) {
if (groups.length == 0) { // Avoid a crash if we try to select a non-existant group
return C.INDEX_UNSET;
}
int trackIndex = 0; // default if no match
String locale2 = Locale.getDefault().getLanguage(); // 2 letter code
String locale3 = Locale.getDefault().getISO3Language(); // 3 letter code