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

Fix bug that causes a crash when the playlist finishes

This commit is contained in:
Daniel Barber 2019-05-10 11:09:11 -04:00
parent ef9f1e12c1
commit ade8423a83
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8
2 changed files with 12 additions and 6 deletions

View File

@ -14,7 +14,7 @@ struct UpdateCurrentCoverArtAction: Action {
}
struct UpdateCurrentSongAction: Action {
var currentSong: Song
var currentSong: Song?
}
struct UpdateElapsedTimeAction: Action {

View File

@ -36,12 +36,18 @@ func queueReducer(action: Action, state: QueueState?) -> QueueState {
}
if newSongRowPos >= 0 {
state.queue[newSongRowPos].isPlaying = true
}
DispatchQueue.main.async {
App.store.dispatch(
UpdateCurrentSongAction(currentSong: state.queue[newSongRowPos].song)
)
DispatchQueue.main.async {
App.store.dispatch(
UpdateCurrentSongAction(currentSong: state.queue[newSongRowPos].song)
)
}
} else {
DispatchQueue.main.async {
App.store.dispatch(
UpdateCurrentSongAction(currentSong: nil)
)
}
}
case let action as UpdateQueuePlayerStateAction: