Skip to content

Commit

Permalink
Fixed return value of GETRANGE / SUBSTR
Browse files Browse the repository at this point in the history
  • Loading branch information
antirez committed Mar 4, 2011
1 parent 7a55d72 commit 74f6ee8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/t_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ void getrangeCommand(redisClient *c) {
return;
if (getLongFromObjectOrReply(c,c->argv[3],&end,NULL) != REDIS_OK)
return;
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.nullbulk)) == NULL ||
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.emptybulk)) == NULL ||
checkType(c,o,REDIS_STRING)) return;

if (o->encoding == REDIS_ENCODING_INT) {
Expand All @@ -280,7 +280,7 @@ void getrangeCommand(redisClient *c) {
/* Precondition: end >= 0 && end < strlen, so the only condition where
* nothing can be returned is: start > end. */
if (start > end) {
addReply(c,shared.nullbulk);
addReply(c,shared.emptybulk);
} else {
addReplyBulkCBuffer(c,(char*)str+start,end-start+1);
}
Expand Down

0 comments on commit 74f6ee8

Please sign in to comment.