From 86fb7b20bfb4bb29a73b48a483d487749bd41de4 Mon Sep 17 00:00:00 2001 From: Hamid Alaei Date: Mon, 1 Oct 2018 13:57:25 +0330 Subject: [PATCH] fix dict get on not found --- src/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module.c b/src/module.c index 2be07ca77..81b04f075 100644 --- a/src/module.c +++ b/src/module.c @@ -4419,7 +4419,7 @@ int RM_DictReplace(RedisModuleDict *d, RedisModuleString *key, void *ptr) { void *RM_DictGetC(RedisModuleDict *d, void *key, size_t keylen, int *nokey) { void *res = raxFind(d->rax,key,keylen); if (nokey) *nokey = (res == raxNotFound); - return res; + return (res == raxNotFound) ? NULL : res; } /* Like RedisModule_DictGetC() but takes the key as a RedisModuleString. */