summaryrefslogtreecommitdiff
path: root/src/t_list.c
diff options
context:
space:
mode:
authorBinbin <binloveplay1314@qq.com>2022-01-11 20:26:13 +0800
committerGitHub <noreply@github.com>2022-01-11 14:26:13 +0200
commit39feee8e3a6fee885aee60672a9dde0dfd08896c (patch)
tree1973c3cd75ba07d726adffa910470a42a43fb2b2 /src/t_list.c
parent1e25bdf7808bb400f2dc552ec0d6690d1b340d23 (diff)
downloadredis-39feee8e3a6fee885aee60672a9dde0dfd08896c.tar.gz
LPOP/RPOP with count against non existing list return null array (#10095)
It used to return `$-1` in RESP2, now we will return `*-1`. This is a bug in redis 6.2 when COUNT was added, the `COUNT` option was introduced in #8179. Fix #10089. the documentation of [LPOP](https://redis.io/commands/lpop) says ``` When called without the count argument: Bulk string reply: the value of the first element, or nil when key does not exist. When called with the count argument: Array reply: list of popped elements, or nil when key does not exist. ```
Diffstat (limited to 'src/t_list.c')
-rw-r--r--src/t_list.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/t_list.c b/src/t_list.c
index 460437853..4d74a1665 100644
--- a/src/t_list.c
+++ b/src/t_list.c
@@ -501,7 +501,7 @@ void popGenericCommand(client *c, int where) {
return;
}
- robj *o = lookupKeyWriteOrReply(c, c->argv[1], shared.null[c->resp]);
+ robj *o = lookupKeyWriteOrReply(c, c->argv[1], hascount ? shared.nullarray[c->resp]: shared.null[c->resp]);
if (o == NULL || checkType(c, o, OBJ_LIST))
return;