aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-23 18:15:25 +0100
committerMax Kellermann <max@duempel.org>2009-01-23 18:15:25 +0100
commita6ad0cdecc9f80de29a25e73ad9a2c855e515552 (patch)
treebd1fce903dc7c75b59b1e02c4a2d07de2a34ef9e
parent21bb0aab9087a0d093c8fe718946bd0961fe9ba7 (diff)
downloadmpd-a6ad0cdecc9f80de29a25e73ad9a2c855e515552.tar.gz
mpd-a6ad0cdecc9f80de29a25e73ad9a2c855e515552.tar.xz
mpd-a6ad0cdecc9f80de29a25e73ad9a2c855e515552.zip
playlist: fix "clear" crash in random mode
When MPD is not playing while in random mode, and the client issues the "clear" command, MPD crashes in stopPlaylist(), or more exactly, in queue_order_to_position(-1). Exit from stopPlaylist() if MPD isn't playing.
Diffstat (limited to '')
-rw-r--r--src/playlist.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 8be8b0553..31d2fe1b8 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -660,6 +660,11 @@ deleteASongFromPlaylist(const struct song *song)
void stopPlaylist(void)
{
+ if (!playlist.playing)
+ return;
+
+ assert(playlist.current >= 0);
+
g_debug("playlist: stop");
playerWait();
playlist.queued = -1;