diff --git a/glib/gqueue.c b/glib/gqueue.c index e8c938a25..0cc7ab200 100644 --- a/glib/gqueue.c +++ b/glib/gqueue.c @@ -519,8 +519,10 @@ g_queue_push_nth_link (GQueue *queue, if (queue->head->prev) queue->head = queue->head->prev; - if (queue->tail->next) - queue->tail = queue->tail->next; + /* The case where we’re pushing @link_ at the end of @queue is handled above + * using g_queue_push_tail_link(), so we should never have to manually adjust + * queue->tail. */ + g_assert (queue->tail->next == NULL); queue->length++; }