Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential IndexOutOfBoundsException #401

Merged
merged 2 commits into from
Jun 22, 2019
Merged

Conversation

marverenic
Copy link
Collaborator

Completes #166105021.

The logic used to generate a sliding window of the current queue for the MediaSession breaks for long queues if the index of the current song is less than 120 songs away from the end of the queue. This PR revisits the logic used to generate this window, which should make it more robust.

Testing Steps

  1. Enqueue a large number of songs (~500 is a good number)
  2. Start playing the second-to-last song in the queue
  3. Press the skip button

Expected behavior: The last song in the queue begins to play
Actual behavior: The music player service crashes

This fixes a build issue on newer versions of Android Studio where no code in ExoPlayer can be referenced when using the full dependency
This fixes a potential IndexOutOfBoundsException when the queue is more than 250 items
@marverenic marverenic merged commit feaf7e9 into master Jun 22, 2019
@marverenic marverenic deleted the m/fix-media-session-queue branch June 22, 2019 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants