Skip to content

Commit

Permalink
Fix IndexOutOfBoundsException in setExoPlayerTrack
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanvelzen committed Jan 4, 2023
1 parent 4ec0bcb commit 103f8ba
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,10 @@ public boolean setExoPlayerTrack(int index, @Nullable org.jellyfin.sdk.model.api
return false;

int chosenTrackType = streamType == org.jellyfin.sdk.model.api.MediaStreamType.SUBTITLE ? C.TRACK_TYPE_TEXT : C.TRACK_TYPE_AUDIO;

// Make sure the index is not out of bounds
if (index >= allStreams.size()) return false;

org.jellyfin.sdk.model.api.MediaStream candidate = allStreams.get(index);
if (candidate.isExternal() || candidate.getType() != streamType)
return false;
Expand Down

0 comments on commit 103f8ba

Please sign in to comment.