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

Reset the queuePos to -1 on queue change

This avoids the index ever being out of range which is what was causing
the crash. The queuePos gets updated straight after the queue anyway.
This commit is contained in:
Daniel Barber 2019-03-03 19:18:53 -05:00
parent d4fe7c396d
commit 30ca11fce4
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8

View File

@ -18,6 +18,8 @@ class QueueDataSource: NSObject, NSOutlineViewDataSource {
let pauseIcon = NSImage(named: "pauseButton")
func updateQueue(_ queue: [MPDClient.Song]) {
queuePos = -1
self.queue = queue.enumerated().map { index, song in
SongItem(song: song, queuePos: index, isPlaying: index == queuePos)
}