From c44732ac58befabf0d6f72f2dae0005ffef7d3c4 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 28 Nov 2017 18:25:14 +0100 Subject: adlist: fix listJoin() in the case the second list is empty. See #4192, the original PR removed lines of code that are actually needed, so thanks to @chunqiulfq for reporting the problem, but merging solution from @jeesyn after checking, together with @artix75, that the logic covers all the cases. --- src/adlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adlist.c b/src/adlist.c index e87d25cee..ec5f8bbf4 100644 --- a/src/adlist.c +++ b/src/adlist.c @@ -353,7 +353,7 @@ void listJoin(list *l, list *o) { else l->head = o->head; - l->tail = o->tail; + if (o->tail) l->tail = o->tail; l->len += o->len; /* Setup other as an empty list. */ -- cgit v1.2.1