playback: fix crash when song cannot be restored
The index is -1, which is not a valid position to seek through normally. In this case we should just ignore it.
This commit is contained in:
@@ -774,8 +774,10 @@ class PlaybackStateManagerImpl @Inject constructor() : PlaybackStateManager {
|
||||
index
|
||||
})
|
||||
|
||||
if (index > -1) {
|
||||
// Valid state where something needs to be played, direct the stateholder to apply
|
||||
// this new state.
|
||||
val oldStateMirror = stateMirror
|
||||
|
||||
if (oldStateMirror.rawQueue != rawQueue) {
|
||||
logD("Queue changed, must reload player")
|
||||
stateHolder?.applySavedState(parent, rawQueue, StateAck.NewPlayback)
|
||||
@@ -787,6 +789,7 @@ class PlaybackStateManagerImpl @Inject constructor() : PlaybackStateManager {
|
||||
stateHolder?.seekTo(savedState.positionMs)
|
||||
stateHolder?.playing(false)
|
||||
}
|
||||
}
|
||||
|
||||
isInitialized = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user