summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2017-11-28 18:25:14 +0100
committerantirez <antirez@gmail.com>2017-11-28 18:25:14 +0100
commitc44732ac58befabf0d6f72f2dae0005ffef7d3c4 (patch)
treeafd9aead9bb21b5efc39e8bb2c9f8104b9d59676
parenta13106e0014644d71bf3aaa577a4a0cce87bf6ed (diff)
downloadredis-c44732ac58befabf0d6f72f2dae0005ffef7d3c4.tar.gz
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.
-rw-r--r--src/adlist.c2
1 files changed, 1 insertions, 1 deletions
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. */