aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/playlist.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 958b6fe14..3b370f9fe 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -997,33 +997,34 @@ void shufflePlaylist(void)
{
unsigned i;
- if (queue_length(&playlist.queue) > 1) {
- if (playlist.playing) {
- if (playlist.queued >= 0)
- clearPlayerQueue();
-
- if (playlist.current >= 0)
- /* put current playing song first */
- swapSongs(0, queue_order_to_position(&playlist.queue,
- playlist.current));
+ if (queue_length(&playlist.queue) <= 1)
+ return;
- if (playlist.queue.random) {
- playlist.current =
- queue_position_to_order(&playlist.queue, 0);
- } else
- playlist.current = 0;
- i = 1;
- } else {
- i = 0;
- playlist.current = -1;
- }
+ if (playlist.playing) {
+ if (playlist.queued >= 0)
+ clearPlayerQueue();
- /* shuffle the rest of the list */
- queue_shuffle_range(&playlist.queue, i,
- queue_length(&playlist.queue));
+ if (playlist.current >= 0)
+ /* put current playing song first */
+ swapSongs(0, queue_order_to_position(&playlist.queue,
+ playlist.current));
- incrPlaylistVersion();
+ if (playlist.queue.random) {
+ playlist.current =
+ queue_position_to_order(&playlist.queue, 0);
+ } else
+ playlist.current = 0;
+ i = 1;
+ } else {
+ i = 0;
+ playlist.current = -1;
}
+
+ /* shuffle the rest of the list */
+ queue_shuffle_range(&playlist.queue, i,
+ queue_length(&playlist.queue));
+
+ incrPlaylistVersion();
}
enum playlist_result savePlaylist(const char *utf8file)