mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
check object type in lookupKeyByPattern
This commit is contained in:
parent
705dad386d
commit
b6f07345c9
8
redis.c
8
redis.c
@ -6533,6 +6533,10 @@ static robj *lookupKeyByPattern(redisDb *db, robj *pattern, robj *subst) {
|
|||||||
initStaticStringObject(fieldobj,((char*)&fieldname)+(sizeof(long)*2));
|
initStaticStringObject(fieldobj,((char*)&fieldname)+(sizeof(long)*2));
|
||||||
o = hashGet(o, &fieldobj);
|
o = hashGet(o, &fieldobj);
|
||||||
} else {
|
} else {
|
||||||
|
if (o->type != REDIS_STRING) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Every object that this function returns needs to have its refcount
|
/* Every object that this function returns needs to have its refcount
|
||||||
* increased. sortCommand decreases it again. */
|
* increased. sortCommand decreases it again. */
|
||||||
incrRefCount(o);
|
incrRefCount(o);
|
||||||
@ -6707,10 +6711,6 @@ static void sortCommand(redisClient *c) {
|
|||||||
/* lookup value to sort by */
|
/* lookup value to sort by */
|
||||||
byval = lookupKeyByPattern(c->db,sortby,vector[j].obj);
|
byval = lookupKeyByPattern(c->db,sortby,vector[j].obj);
|
||||||
if (!byval) continue;
|
if (!byval) continue;
|
||||||
if (byval->type != REDIS_STRING) {
|
|
||||||
decrRefCount(byval);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
/* use object itself to sort by */
|
/* use object itself to sort by */
|
||||||
byval = vector[j].obj;
|
byval = vector[j].obj;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user