From a22c93b659aceaefb0e72d0dedd554971455c02c Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Tue, 3 Nov 2009 23:32:37 +0100
Subject: player_thread: on return, reset next_song only if queued

If no song was queued, then player_control.next_song might contain the
value for the next QUEUE command.  We must not reset that.
---
 src/player_thread.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

(limited to 'src/player_thread.c')

diff --git a/src/player_thread.c b/src/player_thread.c
index d2c8ebfb3..5cb73a3ee 100644
--- a/src/player_thread.c
+++ b/src/player_thread.c
@@ -889,14 +889,18 @@ static void do_play(struct decoder_control *dc)
 
 	player_dc_stop(&player);
 
-	assert(!player.queued || pc.next_song != NULL);
-	pc.next_song = NULL;
-
 	music_pipe_clear(player.pipe, player_buffer);
 	music_pipe_free(player.pipe);
 
 	player_lock();
+
+	if (player.queued) {
+		assert(pc.next_song != NULL);
+		pc.next_song = NULL;
+	}
+
 	pc.state = PLAYER_STATE_STOP;
+
 	player_unlock();
 
 	event_pipe_emit(PIPE_EVENT_PLAYLIST);
-- 
cgit v1.2.3