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

This commit is contained in:
Pieter Noordhuis 2010-04-13 21:25:11 +02:00
parent bc55456975
commit a71f072f73

View File

@ -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;