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

Fix bug where playing a song or album crashes the app

Playing an album would only crash the app if the queue was empty before
trying to play.
This commit is contained in:
Daniel Barber 2019-12-06 14:51:16 -05:00
parent bed09eb888
commit c201ebaab6
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8
2 changed files with 3 additions and 0 deletions

View File

@ -80,6 +80,7 @@ class AlbumDetailView: NSViewController {
let queueLength = App.store.state.queueState.queue.count let queueLength = App.store.state.queueState.queue.count
App.mpdClient.appendSong(song.mpdSong) App.mpdClient.appendSong(song.mpdSong)
App.mpdClient.fetchQueue()
App.mpdClient.playTrack(at: queueLength) App.mpdClient.playTrack(at: queueLength)
} }
@ -89,6 +90,7 @@ class AlbumDetailView: NSViewController {
let queueLength = App.store.state.queueState.queue.count let queueLength = App.store.state.queueState.queue.count
App.mpdClient.appendSong(song.mpdSong) App.mpdClient.appendSong(song.mpdSong)
App.mpdClient.fetchQueue()
App.mpdClient.playTrack(at: queueLength) App.mpdClient.playTrack(at: queueLength)
} }

View File

@ -45,6 +45,7 @@ extension MPDClient {
priority: .normal, priority: .normal,
userData: ["songs": songs] userData: ["songs": songs]
) )
self.enqueueCommand(command: .fetchQueue)
self.enqueueCommand( self.enqueueCommand(
command: .playTrack, command: .playTrack,
priority: .normal, priority: .normal,