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:
parent
ef9f1e12c1
commit
ade8423a83
@ -14,7 +14,7 @@ struct UpdateCurrentCoverArtAction: Action {
|
||||
}
|
||||
|
||||
struct UpdateCurrentSongAction: Action {
|
||||
var currentSong: Song
|
||||
var currentSong: Song?
|
||||
}
|
||||
|
||||
struct UpdateElapsedTimeAction: Action {
|
||||
|
||||
@ -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:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user