command/QueueCommands: disallow moving the current song relative to itself

This was a no-op previously, but this operation makes no sense.
This commit is contained in:
Max Kellermann 2021-10-07 22:55:29 +02:00
parent c0bcfe244c
commit 78e49928b6

View File

@ -378,8 +378,7 @@ ParseMoveDestination(const char *s, const RangeArg range,
unsigned current = RequireCurrentPosition(p); unsigned current = RequireCurrentPosition(p);
assert(current < queue_length); assert(current < queue_length);
if (range.Contains(current)) if (range.Contains(current))
/* no-op */ throw ProtocolError(ACK_ERROR_ARG, "Cannot move current song relative to itself");
return range.start;
if (current >= range.end) if (current >= range.end)
current -= range.Count(); current -= range.Count();
@ -393,8 +392,7 @@ ParseMoveDestination(const char *s, const RangeArg range,
unsigned current = RequireCurrentPosition(p); unsigned current = RequireCurrentPosition(p);
assert(current < queue_length); assert(current < queue_length);
if (range.Contains(current)) if (range.Contains(current))
/* no-op */ throw ProtocolError(ACK_ERROR_ARG, "Cannot move current song relative to itself");
return range.start;
if (current >= range.end) if (current >= range.end)
current -= range.Count(); current -= range.Count();