]> git.saurik.com Git - redis.git/commitdiff
move retrieval of long up to prevent an empty hash from being created
authorPieter Noordhuis <pcnoordhuis@gmail.com>
Tue, 13 Apr 2010 19:25:11 +0000 (21:25 +0200)
committerPieter Noordhuis <pcnoordhuis@gmail.com>
Thu, 15 Apr 2010 17:16:38 +0000 (19:16 +0200)
redis.c

diff --git a/redis.c b/redis.c
index db46763b8a8db0a81231be3d7a9ffde857634445..ffd66984ea8ffa3a44e249a0012352b24dbd64d5 100644 (file)
--- 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;