From 78e49928b655164b157eaf40c23dffd977b2fdd8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 7 Oct 2021 22:55:29 +0200 Subject: [PATCH] command/QueueCommands: disallow moving the current song relative to itself This was a no-op previously, but this operation makes no sense. --- src/command/QueueCommands.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/command/QueueCommands.cxx b/src/command/QueueCommands.cxx index 3ab7a9143..7b1861172 100644 --- a/src/command/QueueCommands.cxx +++ b/src/command/QueueCommands.cxx @@ -378,8 +378,7 @@ ParseMoveDestination(const char *s, const RangeArg range, unsigned current = RequireCurrentPosition(p); assert(current < queue_length); if (range.Contains(current)) - /* no-op */ - return range.start; + throw ProtocolError(ACK_ERROR_ARG, "Cannot move current song relative to itself"); if (current >= range.end) current -= range.Count(); @@ -393,8 +392,7 @@ ParseMoveDestination(const char *s, const RangeArg range, unsigned current = RequireCurrentPosition(p); assert(current < queue_length); if (range.Contains(current)) - /* no-op */ - return range.start; + throw ProtocolError(ACK_ERROR_ARG, "Cannot move current song relative to itself"); if (current >= range.end) current -= range.Count();