提交 6485f293 编写于 作者: P Pieter Noordhuis

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

上级 1b677732
......@@ -4231,8 +4231,8 @@ static void incrDecrCommand(redisClient *c, long long incr) {
robj *o;
o = lookupKeyWrite(c->db,c->argv[1]);
if (getLongLongFromObjectOrReply(c, o, &value, NULL) != REDIS_OK) return;
if (o != NULL && checkType(c,o,REDIS_STRING)) return;
if (getLongLongFromObjectOrReply(c,o,&value,NULL) != REDIS_OK) return;
value += incr;
o = createObject(REDIS_STRING,sdscatprintf(sdsempty(),"%lld",value));
......
......@@ -373,7 +373,7 @@ proc main {} {
test {INCR fails against a key holding a list} {
$r rpush mylist 1
catch {$r incr novar} err
catch {$r incr mylist} err
$r rpop mylist
format $err
} {ERR*}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册