Commit e79ee263 authored by antirez's avatar antirez
Browse files

Fix XRANGE COUNT option for value of 0.

parent 505cc70f
...@@ -1260,7 +1260,7 @@ void xrangeGenericCommand(client *c, int rev) { ...@@ -1260,7 +1260,7 @@ void xrangeGenericCommand(client *c, int rev) {
robj *o; robj *o;
stream *s; stream *s;
streamID startid, endid; streamID startid, endid;
long long count = 0; long long count = -1;
robj *startarg = rev ? c->argv[3] : c->argv[2]; robj *startarg = rev ? c->argv[3] : c->argv[2];
robj *endarg = rev ? c->argv[2] : c->argv[3]; robj *endarg = rev ? c->argv[2] : c->argv[3];
...@@ -1287,7 +1287,13 @@ void xrangeGenericCommand(client *c, int rev) { ...@@ -1287,7 +1287,13 @@ void xrangeGenericCommand(client *c, int rev) {
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.emptymultibulk)) == NULL if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.emptymultibulk)) == NULL
|| checkType(c,o,OBJ_STREAM)) return; || checkType(c,o,OBJ_STREAM)) return;
s = o->ptr; s = o->ptr;
streamReplyWithRange(c,s,&startid,&endid,count,rev,NULL,NULL,0,NULL);
if (count == 0) {
addReply(c,shared.nullmultibulk);
} else {
if (count == -1) count = 0;
streamReplyWithRange(c,s,&startid,&endid,count,rev,NULL,NULL,0,NULL);
}
} }
/* XRANGE key start end [COUNT <n>] */ /* XRANGE key start end [COUNT <n>] */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment