HGET fix for integer encoded field against zipmap encoded hash

This commit is contained in:
antirez
2010-03-16 18:44:37 +01:00
parent 23d8214891
commit 164ee59564
2 changed files with 65 additions and 1 deletions

View File

@ -5870,14 +5870,18 @@ static void hgetCommand(redisClient *c) {
unsigned char *zm = o->ptr;
unsigned char *val;
unsigned int vlen;
robj *field;
if (zipmapGet(zm,c->argv[2]->ptr,sdslen(c->argv[2]->ptr), &val,&vlen)) {
field = getDecodedObject(c->argv[2]);
if (zipmapGet(zm,field->ptr,sdslen(field->ptr), &val,&vlen)) {
addReplySds(c,sdscatprintf(sdsempty(),"$%u\r\n", vlen));
addReplySds(c,sdsnewlen(val,vlen));
addReply(c,shared.crlf);
decrRefCount(field);
return;
} else {
addReply(c,shared.nullbulk);
decrRefCount(field);
return;
}
} else {