Permalink
Browse files

move retrieval of long up to prevent an empty hash from being created

  • Loading branch information...
1 parent bc55456 commit a71f072f7352e8879ac8e39dbfcf19369395ce93 @pietern pietern committed Apr 13, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 redis.c
View
@@ -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;

0 comments on commit a71f072

Please sign in to comment.