playlist editor: fix jumping from the last occurrence of song in playlists

This commit is contained in:
Andrzej Rybczak
2017-02-18 11:18:06 +01:00
parent 0cdbe31ecb
commit 00cbbe5593

View File

@@ -523,10 +523,13 @@ void PlaylistEditor::locateSong(const MPD::Song &s)
return false;
};
for (auto pl_it = Playlists.currentV() + 1; pl_it != Playlists.endV(); ++pl_it)
auto begin = Playlists.beginV(), end = Playlists.endV();
auto current_successor = ++Playlists.currentV();
for (auto pl_it = current_successor; pl_it != end; ++pl_it)
if (locate_and_switch_playlist(pl_it))
return;
for (auto pl_it = Playlists.beginV(); pl_it != Playlists.currentV(); ++pl_it)
for (auto pl_it = begin; pl_it != current_successor; ++pl_it)
if (locate_and_switch_playlist(pl_it))
return;
}