From: Pieter Noordhuis Date: Tue, 13 Apr 2010 19:25:11 +0000 (+0200) Subject: move retrieval of long up to prevent an empty hash from being created X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/a71f072f7352e8879ac8e39dbfcf19369395ce93 move retrieval of long up to prevent an empty hash from being created --- diff --git a/redis.c b/redis.c index db46763b..ffd66984 100644 --- a/redis.c +++ b/redis.c @@ -6166,6 +6166,8 @@ static void hincrbyCommand(redisClient *c) { long long value = 0, incr = 0; robj *o = lookupKeyWrite(c->db,c->argv[1]); + if (getLongLongFromObject(c, c->argv[3], &incr) != REDIS_OK) return; + if (o == NULL) { o = createHashObject(); dictAdd(c->db->dict,c->argv[1],o); @@ -6177,8 +6179,6 @@ static void hincrbyCommand(redisClient *c) { } } - if (getLongLongFromObject(c, c->argv[3], &incr) != REDIS_OK) return; - if (o->encoding == REDIS_ENCODING_ZIPMAP) { unsigned char *zm = o->ptr; unsigned char *zval;