From 70ffa8ce5c6510bd7bf257a477e684d9a32ec1ac Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 18 Mar 2025 21:37:06 +0100 Subject: [PATCH] Fix VADD_CASReply() NULL reference on ID mismatch. This bug was fixed thanks to the kind help of Dvir Dukhan (@DvirDukhan) that found it and provided useful context. --- vset.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vset.c b/vset.c index 3be8e2f9e..7ccd6dae3 100644 --- a/vset.c +++ b/vset.c @@ -340,7 +340,8 @@ int VADD_CASReply(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) { * the other insert won. We don't even start a threaded VADD * if this was an udpate, since the deletion of the element itself * in order to perform the update would invalidate the CAS state. */ - if (RedisModule_DictGet(vset->dict,val,NULL) != NULL) vset = NULL; + if (vset && RedisModule_DictGet(vset->dict,val,NULL) != NULL) + vset = NULL; } if (vset == NULL) {