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 IndexOutOfBoundsException on service start #403

Merged
merged 1 commit into from
Jun 22, 2019

Conversation

marverenic
Copy link
Collaborator

Completes #166859204.

This fixes an issue where the player service would crash when restoring its state on launch if there are songs that could not be found in the saved state.

Testing Steps

  • Begin playing music
  • Skip to the last track in the queue
  • Close Jockey
  • Delete the file for the previously playing song from the device entirely
  • Restart Jockey

Expected Behavior:

  • Jockey should restore as much of the queue as possible

Actual Behavior:

  • The player service crashes on startup

Stacktrace:

Caused by java.lang.IllegalArgumentException: index must be smaller than the queue size (1)
       at com.marverenic.music.player.QueuedExoPlayer.setQueue(QueuedExoPlayer.java:235)
       at com.marverenic.music.player.MusicPlayer.setBackingQueue(MusicPlayer.java:922)
       at com.marverenic.music.player.MusicPlayer.restorePlayerState(MusicPlayer.java:1300)
       at com.marverenic.music.player.extensions.persistence.PersistenceExtension.onCreateMusicPlayer(PersistenceExtension.java:31)
       at com.marverenic.music.player.MusicPlayer.(MusicPlayer.java:258)
       at com.marverenic.music.player.PlayerService.onCreate(PlayerService.java:110)
       at android.app.ActivityThread.handleCreateService(ActivityThread.java:3750)
       at android.app.ActivityThread.access$1400(ActivityThread.java:237)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1801)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:214)
       at android.app.ActivityThread.main(ActivityThread.java:7045)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)

@marverenic marverenic merged commit b99d572 into master Jun 22, 2019
@marverenic marverenic deleted the m/fix-player-launch-index-out-of-bounds branch June 22, 2019 20:42
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