command/queue: better error message for open-ended range with "move"
The "move" command doesn't allow open-ended ranges because they don't make a lot of sense; moving an open-ended range is only possible if the destination index is before the range, and in that case, the client should be well aware how many songs there are. Closes https://github.com/MusicPlayerDaemon/MPD/pull/1057
This commit is contained in:
@@ -326,6 +326,11 @@ CommandResult
|
||||
handle_move(Client &client, Request args, [[maybe_unused]] Response &r)
|
||||
{
|
||||
RangeArg range = args.ParseRange(0);
|
||||
if (range.IsOpenEnded()) {
|
||||
r.Error(ACK_ERROR_ARG, "Open-ended range not supported");
|
||||
return CommandResult::ERROR;
|
||||
}
|
||||
|
||||
int to = args.ParseInt(1);
|
||||
client.GetPartition().MoveRange(range.start, range.end, to);
|
||||
return CommandResult::OK;
|
||||
|
Reference in New Issue
Block a user