Commit 6485f293 authored by Pieter Noordhuis's avatar Pieter Noordhuis
Browse files

fix to return error when calling INCR on a non-string type

parent 1b677732
...@@ -4231,8 +4231,8 @@ static void incrDecrCommand(redisClient *c, long long incr) { ...@@ -4231,8 +4231,8 @@ static void incrDecrCommand(redisClient *c, long long incr) {
robj *o; robj *o;
o = lookupKeyWrite(c->db,c->argv[1]); o = lookupKeyWrite(c->db,c->argv[1]);
if (o != NULL && checkType(c,o,REDIS_STRING)) return;
if (getLongLongFromObjectOrReply(c, o, &value, NULL) != REDIS_OK) return; if (getLongLongFromObjectOrReply(c,o,&value,NULL) != REDIS_OK) return;
value += incr; value += incr;
o = createObject(REDIS_STRING,sdscatprintf(sdsempty(),"%lld",value)); o = createObject(REDIS_STRING,sdscatprintf(sdsempty(),"%lld",value));
......
...@@ -373,7 +373,7 @@ proc main {} { ...@@ -373,7 +373,7 @@ proc main {} {
test {INCR fails against a key holding a list} { test {INCR fails against a key holding a list} {
$r rpush mylist 1 $r rpush mylist 1
catch {$r incr novar} err catch {$r incr mylist} err
$r rpop mylist $r rpop mylist
format $err format $err
} {ERR*} } {ERR*}
......
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