From a71f072f7352e8879ac8e39dbfcf19369395ce93 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Tue, 13 Apr 2010 21:25:11 +0200 Subject: [PATCH] move retrieval of long up to prevent an empty hash from being created --- redis.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; -- GitLab