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.
This commit is contained in:
Max Kellermann 2009-01-23 18:15:25 +01:00
parent 21bb0aab90
commit a6ad0cdecc

View File

@ -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;