summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2021-02-15 20:51:12 +0100
committerMax Kellermann <max@musicpd.org>2021-02-15 20:57:22 +0100
commit6b1d264b352a17bf0ed59f79960359cd4949d8df (patch)
tree455130ff0ca9394a149bbc051a5515499622fffc
parenta6c10e9a1c37defe67c056ada3a41f62c404d5f7 (diff)
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
-rw-r--r--NEWS1
-rw-r--r--src/command/QueueCommands.cxx5
2 files changed, 6 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 9bda29812..7a85fb437 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
ver 0.22.5 (not yet released)
* protocol
- error for malformed ranges instead of ignoring silently
+ - better error message for open-ended range with "move"
* database
- simple: fix missing CUE sheet metadata in "addid" command
* tags
diff --git a/src/command/QueueCommands.cxx b/src/command/QueueCommands.cxx
index c77b62b3e..ba8c5a423 100644
--- a/src/command/QueueCommands.cxx
+++ b/src/command/QueueCommands.cxx
@@ -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;