From 25029568358e70ac92c6048af4001f4c379ab788 Mon Sep 17 00:00:00 2001 From: Guy Benoish Date: Wed, 23 Jan 2019 11:11:57 +0200 Subject: [PATCH] ZPOP should return an empty array if COUNT=0 --- src/t_zset.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/t_zset.c b/src/t_zset.c index 0427ee88..1c3da1a2 100644 --- a/src/t_zset.c +++ b/src/t_zset.c @@ -3140,7 +3140,10 @@ void genericZpopCommand(client *c, robj **keyv, int keyc, int where, int emitkey if (countarg) { if (getLongFromObjectOrReply(c,countarg,&count,NULL) != C_OK) return; - if (count < 0) count = 1; + if (count <= 0) { + addReplyNullArray(c); + return; + } } /* Check type and break on the first error, otherwise identify candidate. */