diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-09-28 15:15:52 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-09-28 15:15:52 -0700 |
commit | 54df40c5f96eb8fe80b50dd8a85e8045c7dac9d4 (patch) | |
tree | 9028dacdb23f5d314e691c416d48f8a1b78ed901 /src | |
parent | 98f0bb23d71e94b3a6f12844ce4aec373f8701e8 (diff) | |
download | mpd-54df40c5f96eb8fe80b50dd8a85e8045c7dac9d4.tar.gz mpd-54df40c5f96eb8fe80b50dd8a85e8045c7dac9d4.tar.xz mpd-54df40c5f96eb8fe80b50dd8a85e8045c7dac9d4.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/playlist.c | 4 |
1 files changed, 4 insertions, 0 deletions
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; |