From 00cbbe55932fc2231fd3bfafd8cebea135819946 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sat, 18 Feb 2017 11:18:06 +0100 Subject: [PATCH] playlist editor: fix jumping from the last occurrence of song in playlists --- src/screens/playlist_editor.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/screens/playlist_editor.cpp b/src/screens/playlist_editor.cpp index bf36d623..402c0359 100644 --- a/src/screens/playlist_editor.cpp +++ b/src/screens/playlist_editor.cpp @@ -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; }