Verified Commit ccf8e940 authored by Sumner Evans's avatar Sumner Evans 💬
Browse files

Fixes #89: prevent errors when you remove all songs from the play queue

parent 120f7696
Pipeline #117820200 passed with stages
in 11 minutes and 8 seconds
......@@ -615,12 +615,21 @@ class SublimeMusicApp(Gtk.Application):
song_id for i, song_id in enumerate(self.state.play_queue)
if i not in song_indexes_to_remove
]
# Determine how many songs before the currently playing one were also
# deleted.
before_current = [
i for i in song_indexes_to_remove
if i < self.state.current_song_index
]
if self.state.current_song_index in song_indexes_to_remove:
if len(self.state.play_queue) == 0:
self.on_play_pause()
self.state.current_song_index = -1
self.update_window()
return
self.state.current_song_index -= len(before_current)
self.play_song(self.state.current_song_index, reset=True)
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment