From a6ad0cdecc9f80de29a25e73ad9a2c855e515552 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 23 Jan 2009 18:15:25 +0100 Subject: 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. --- src/playlist.c | 5 +++++ 1 file changed, 5 insertions(+) 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; -- cgit v1.2.3