diff --git a/src/bitops.c b/src/bitops.c index a7fad899..a7e193f8 100644 --- a/src/bitops.c +++ b/src/bitops.c @@ -1049,12 +1049,14 @@ void bitfieldCommand(client *c) { } else { /* GET */ unsigned char buf[9]; - long strlen; + long strlen = 0; unsigned char *src = NULL; char llbuf[LONG_STR_SIZE]; - o = lookupKeyRead(c->db,c->argv[1]); - src = getObjectReadOnlyString(o,&strlen,llbuf); + if ((o = lookupKeyRead(c->db,c->argv[1])) != NULL) { + if (checkType(c,o,OBJ_STRING)) continue; + src = getObjectReadOnlyString(o,&strlen,llbuf); + } /* For GET we use a trick: before executing the operation * copy up to 9 bytes to a local buffer, so that we can easily