diff --git a/src/module.c b/src/module.c index be64af368..65c0f5b3f 100644 --- a/src/module.c +++ b/src/module.c @@ -5150,7 +5150,7 @@ RedisModuleTimerID RM_CreateTimer(RedisModuleCtx *ctx, mstime_t period, RedisMod timer->module = ctx->module; timer->callback = callback; timer->data = data; - timer->dbid = ctx->client->db->id; + timer->dbid = ctx->client ? ctx->client->db->id : 0; uint64_t expiretime = ustime()+period*1000; uint64_t key;