diff --git a/src/player.c b/src/player.c index 4806c74a..f34eedeb 100644 --- a/src/player.c +++ b/src/player.c @@ -3429,6 +3429,7 @@ static int playerqueue_move_bypos(struct player_command *cmd) { struct player_source *ps_playing; + uint32_t item_id; DPRINTF(E_DBG, L_PLAYER, "Moving song from position %d to be the next song after %d\n", cmd->arg.queue_move_param.from_pos, cmd->arg.queue_move_param.to_pos); @@ -3437,11 +3438,13 @@ playerqueue_move_bypos(struct player_command *cmd) if (!ps_playing) { - DPRINTF(E_LOG, L_PLAYER, "Can't move item, no playing item found\n"); - return -1; + DPRINTF(E_DBG, L_PLAYER, "No playing item found for move by pos\n"); + item_id = 0; } + else + item_id = ps_playing->item_id; - queue_move_bypos(queue, ps_playing->item_id, cmd->arg.queue_move_param.from_pos, cmd->arg.queue_move_param.to_pos, shuffle); + queue_move_bypos(queue, item_id, cmd->arg.queue_move_param.from_pos, cmd->arg.queue_move_param.to_pos, shuffle); cur_plversion++; diff --git a/src/queue.c b/src/queue.c index 136b2941..b6b4ad8a 100644 --- a/src/queue.c +++ b/src/queue.c @@ -336,7 +336,7 @@ queueitem_get_bypos(struct queue *queue, unsigned int item_id, unsigned int pos, return NULL; i = 0; - for (item = item_base; item != queue->head && i < pos; item = item_next(item, shuffle)) + for (item = item_base; i < pos; item = item_next(item, shuffle)) { i++; }