From 34244398d01b4182558f45c6363be62d37c29b50 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 10 Feb 2009 17:55:08 +0100 Subject: playlist: fix assertion when last/current song is deleted When MPD is stopped, but the last song is still the "current song", and you delete it, playlist->current is not updated, and becomes an invalid value. Fix this by catching "!playlist->playing && playlist->current == (int)songOrder". --- src/playlist_edit.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/playlist_edit.c') diff --git a/src/playlist_edit.c b/src/playlist_edit.c index 008ae3147..1a76273b4 100644 --- a/src/playlist_edit.c +++ b/src/playlist_edit.c @@ -243,7 +243,10 @@ deleteFromPlaylist(struct playlist *playlist, unsigned song) stopPlaylist(playlist); queued = NULL; - } + } else if (playlist->current == (int)songOrder) + /* there's a "current song" but we're not playing + currently - clear "current" */ + playlist->current = -1; /* now do it: remove the song */ -- cgit v1.2.3