summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-12-20 10:19:06 +0100
committerantirez <antirez@gmail.com>2016-12-20 10:20:13 +0100
commit0f72257049f76c8371e2dc18336a4d1015d06a99 (patch)
tree52bca88bfee5ca5aaa8dc4f91528056ee600079a
parent913070a9e85170e89176e5dc9488263cc7327085 (diff)
downloadredis-0f72257049f76c8371e2dc18336a4d1015d06a99.tar.gz
Geo: fix GEOHASH return value for consistency.
The same thing observed in #3551 by gnethercutt also fixed for GEOHASH as the original PR did.
-rw-r--r--src/geo.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/geo.c b/src/geo.c
index e1d026f1e..8423931af 100644
--- a/src/geo.c
+++ b/src/geo.c
@@ -684,16 +684,15 @@ void geohashCommand(client *c) {
int j;
/* Look up the requested zset */
- robj *zobj = NULL;
- if ((zobj = lookupKeyReadOrReply(c, c->argv[1], shared.emptymultibulk))
- == NULL || checkType(c, zobj, OBJ_ZSET)) return;
+ robj *zobj = lookupKeyRead(c->db, c->argv[1]);
+ if (zobj && checkType(c, zobj, OBJ_ZSET)) return;
/* Geohash elements one after the other, using a null bulk reply for
* missing elements. */
addReplyMultiBulkLen(c,c->argc-2);
for (j = 2; j < c->argc; j++) {
double score;
- if (zsetScore(zobj, c->argv[j]->ptr, &score) == C_ERR) {
+ if (!zobj || zsetScore(zobj, c->argv[j]->ptr, &score) == C_ERR) {
addReply(c,shared.nullbulk);
} else {
/* The internal format we use for geocoding is a bit different