1
1
mirror of https://github.com/danbee/persephone synced 2025-03-04 08:39:11 +00:00

Fix queuepos out of bounds error

Sometimes the status gets updated before the queue has been retrieved.
In these cases we want to skip setting the current song until it has
been.
This commit is contained in:
Daniel Barber 2020-01-13 21:59:30 -05:00
parent 8e81636500
commit 9a69734c23

View File

@ -36,7 +36,7 @@ func queueReducer(action: Action, state: QueueState?) -> QueueState {
if oldSongRowPos >= 0 { if oldSongRowPos >= 0 {
state.queue[oldSongRowPos].isPlaying = false state.queue[oldSongRowPos].isPlaying = false
} }
if newSongRowPos >= 0 { if newSongRowPos >= 0 && state.queue.count > newSongRowPos {
state.queue[newSongRowPos].isPlaying = true state.queue[newSongRowPos].isPlaying = true
DispatchQueue.main.async { DispatchQueue.main.async {