summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2020-09-10 10:09:13 +0300
committerGitHub <noreply@github.com>2020-09-10 10:09:13 +0300
commitde8d32023089333d6b05ac361b9c2f2ecc386868 (patch)
tree215fd48c3edf847f41502444445e32a92ec384bc /src
parentb2a73c404bf277bac287c72494a4c4cd2ba02f8c (diff)
downloadredis-de8d32023089333d6b05ac361b9c2f2ecc386868.tar.gz
Fix RESP3 response for HKEYS/HVALS on non-existing key (#7781)
Diffstat (limited to 'src')
-rw-r--r--src/t_hash.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/t_hash.c b/src/t_hash.c
index e6f7b6be9..8421223cd 100644
--- a/src/t_hash.c
+++ b/src/t_hash.c
@@ -766,7 +766,9 @@ void genericHgetallCommand(client *c, int flags) {
hashTypeIterator *hi;
int length, count = 0;
- if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.emptymap[c->resp]))
+ robj *emptyResp = (flags & OBJ_HASH_KEY && flags & OBJ_HASH_VALUE) ?
+ shared.emptymap[c->resp] : shared.emptyarray;
+ if ((o = lookupKeyReadOrReply(c,c->argv[1],emptyResp))
== NULL || checkType(c,o,OBJ_HASH)) return;
/* We return a map if the user requested keys and values, like in the