Skip to content

Commit

Permalink
Merge pull request #1233 from react-native-community/bugfix/no-audio-…
Browse files Browse the repository at this point in the history
…crash

Avoid crash when there are no tracks to choose from
  • Loading branch information
cobarx authored Sep 13, 2018
2 parents b514246 + 5e36060 commit 44b626a
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,10 @@ public void setSelectedTrack(int trackType, String type, Dynamic value) {
}

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
Expand Down

0 comments on commit 44b626a

Please sign in to comment.