db/DatabasePlaylist: increment only one variable

Fixes "searchaddpl" bug emitting bogus error "Bad position".

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1338
This commit is contained in:
Max Kellermann 2021-11-22 20:47:06 +01:00
parent 77df5a8f24
commit dcb5ca203c
2 changed files with 3 additions and 2 deletions

2
NEWS
View File

@ -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

View File

@ -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;
});