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 9f948df141
commit d075a06c41
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8

View File

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