Playlist Controller: Stop when deleting current

When deleting the currently playing track, stop playback, because the
player engine doesn't like dealing with the current playing track not
actually having a playlist reference to go with it. Better stop playback
instead, as a safety check.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
CQTexperiment
Christopher Snowhill 2022-02-04 19:54:43 -08:00
parent 39cc33cac4
commit 6d9f1be7ea
1 changed files with 5 additions and 0 deletions

View File

@ -606,6 +606,11 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
for (PlaylistEntry *pe in objects) {
[unarrangedIndexes addIndex:[pe index]];
}
if ([indexes containsIndex:currentEntry.index]) {
// Safety check. The player doesn't like committing actions on a removed track
[playbackController stop:nil];
}
if (currentEntry.index >= 0 && [unarrangedIndexes containsIndex:currentEntry.index]) {
currentEntry.index = -currentEntry.index - 1;