playback: dont apply state mirror w/no song

Otherwise, the StateHolder will crash.
This commit is contained in:
Alexander Capehart 2024-01-28 20:22:34 -07:00
parent fbd8d4b361
commit ced462e718
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47

View file

@ -418,7 +418,7 @@ class PlaybackStateManagerImpl @Inject constructor() : PlaybackStateManager {
} }
this.stateHolder = stateHolder this.stateHolder = stateHolder
if (isInitialized) { if (isInitialized && stateMirror.index > -1) {
stateHolder.applySavedState(stateMirror.parent, stateMirror.rawQueue, null) stateHolder.applySavedState(stateMirror.parent, stateMirror.rawQueue, null)
stateHolder.seekTo(stateMirror.progression.calculateElapsedPositionMs()) stateHolder.seekTo(stateMirror.progression.calculateElapsedPositionMs())
stateHolder.playing(false) stateHolder.playing(false)
@ -753,7 +753,7 @@ class PlaybackStateManagerImpl @Inject constructor() : PlaybackStateManager {
} }
var index = savedState.index var index = savedState.index
while (pointingAtSong() && index > -1) { while (!pointingAtSong() && index > -1) {
index-- index--
} }