summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Benoish <guy.benoish@redislabs.com>2019-01-23 11:11:57 +0200
committerGuy Benoish <guy.benoish@redislabs.com>2019-01-23 11:11:57 +0200
commit25029568358e70ac92c6048af4001f4c379ab788 (patch)
tree02d48696b349dd061e398183f4c9774a8b58e9d3
parentb270322ff9d008ceafcaac68a89967d2b34d8626 (diff)
downloadredis-25029568358e70ac92c6048af4001f4c379ab788.tar.gz
ZPOP should return an empty array if COUNT=0
-rw-r--r--src/t_zset.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/t_zset.c b/src/t_zset.c
index 0427ee887..1c3da1a28 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. */