aboutsummaryrefslogtreecommitdiffstats
path: root/src/Playlist.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-07-11 19:41:39 +0200
committerMax Kellermann <max@duempel.org>2014-07-11 19:41:39 +0200
commite2cc328eef4d7c19a6bc7755779babe88ff51105 (patch)
treead2bcfa2031a979a5853e5d0ef9b8d721e79155c /src/Playlist.cxx
parent344d10a8e3466345c41209656fd91ede39ff93f4 (diff)
downloadmpd-e2cc328eef4d7c19a6bc7755779babe88ff51105.tar.gz
mpd-e2cc328eef4d7c19a6bc7755779babe88ff51105.tar.xz
mpd-e2cc328eef4d7c19a6bc7755779babe88ff51105.zip
Playlist: randomize next song when enabling "random" mode while not playing
Don't restore the current song after shufflung when MPD is stopped (but still remembers the current song internally). Fixes the first part of Mantis ticket 0004005.
Diffstat (limited to '')
-rw-r--r--src/Playlist.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Playlist.cxx b/src/Playlist.cxx
index 8d9ab24a3..ac2cc494b 100644
--- a/src/Playlist.cxx
+++ b/src/Playlist.cxx
@@ -294,7 +294,9 @@ playlist::SetRandom(PlayerControl &pc, bool status)
if (queue.random) {
/* shuffle the queue order, but preserve current */
- const int current_position = GetCurrentPosition();
+ const int current_position = playing
+ ? GetCurrentPosition()
+ : -1;
queue.ShuffleOrder();