From 54df40c5f96eb8fe80b50dd8a85e8045c7dac9d4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 28 Sep 2008 15:15:52 -0700 Subject: playlist: fix currentsong info after swapping songs We forgot to update the playlist.queued marker if playlist.current changed. Additionally, if the queue cleared in any other mode, attempt to requeue (as it's a harmless no-op otherwise). Thanks to stonecrest for the bug report. --- src/playlist.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/playlist.c') diff --git a/src/playlist.c b/src/playlist.c index c6a918201..0e35bfbdb 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -677,6 +677,7 @@ enum playlist_result swapSongsInPlaylist(int song1, int song2) { int queuedSong = -1; int currentSong; + int queued_is_current = (playlist.queued == playlist.current); if (song1 < 0 || song1 >= playlist.length || song2 < 0 || song2 >= playlist.length) @@ -714,8 +715,11 @@ enum playlist_result swapSongsInPlaylist(int song1, int song2) playlist.current = song2; else if (playlist.current == song2) playlist.current = song1; + if (queued_is_current) + playlist.queued = playlist.current; } + queueNextSongInPlaylist(); incrPlaylistVersion(); return PLAYLIST_RESULT_SUCCESS; -- cgit v1.2.3