From 6d720dec943eb2438346284a9cda9ec3136197e0 Mon Sep 17 00:00:00 2001 From: chme Date: Sun, 22 Nov 2015 07:08:59 +0100 Subject: [PATCH] [queue] Ignore moving an item to its current position (would results in an invalid queue) --- src/queue.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/queue.c b/src/queue.c index 688e3098..424ae197 100644 --- a/src/queue.c +++ b/src/queue.c @@ -787,10 +787,17 @@ queue_move_byitemid(struct queue *queue, unsigned int item_id, unsigned int to_p return; } + index = queue_index_byitemid(queue, item_id, shuffle); + + if (index == to_pos) + { + DPRINTF(E_DBG, L_PLAYER, "Ignore moving item %d from index %d to %d\n", item_id, index, to_pos); + return; + } + // Check if the index of the item to move is lower than the target index // If that is the case, increment the target position, because the given to_pos // is based on the queue without the moved item. - index = queue_index_byitemid(queue, item_id, shuffle); if (index < to_pos) to_pos++;