From dcb5ca203c891c3e7f17a8cbac6229c098667e9d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 22 Nov 2021 20:47:06 +0100 Subject: [PATCH] db/DatabasePlaylist: increment only one variable Fixes "searchaddpl" bug emitting bogus error "Bad position". Closes https://github.com/MusicPlayerDaemon/MPD/issues/1338 --- NEWS | 2 ++ src/db/DatabasePlaylist.cxx | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 4ebb03969..5d5b4c260 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.23.5 (not yet released) +* protocol + - fix "searchaddpl" bug (bogus error "Bad position") * migrate to PCRE2 * GCC 12 build fixes diff --git a/src/db/DatabasePlaylist.cxx b/src/db/DatabasePlaylist.cxx index 0e14a97fc..7d86b4b62 100644 --- a/src/db/DatabasePlaylist.cxx +++ b/src/db/DatabasePlaylist.cxx @@ -53,10 +53,9 @@ SearchInsertIntoPlaylist(const Database &db, const Storage *storage, unsigned n = 0; - db.Visit(selection, [&playlist, &position, &n, storage](const auto &song){ + db.Visit(selection, [&playlist, position, &n, storage](const auto &song){ playlist.Insert(position + n, DatabaseDetachSong(storage, song)); - ++position; ++n; });