From 764838d66fabaf4c866b2f674625ee3486098765 Mon Sep 17 00:00:00 2001 From: Binbin Date: Tue, 5 Dec 2023 02:12:48 +0800 Subject: [PATCH] Check whether the client is NULL in luaCreateFunction (#12829) It was first added to load lua from RDB, see 28dfdca7. After #9812, we no longer save lua in RDB. luaCreateFunction will only be called in script load and eval*, both of which are available in the client. It could be that that some day we'll still want to load scripts from somewhere that's not a client. This fix is in dead code. --- src/eval.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/eval.c b/src/eval.c index eb4b52936..47989a0ac 100644 --- a/src/eval.c +++ b/src/eval.c @@ -436,7 +436,9 @@ sds luaCreateFunction(client *c, robj *body) { ssize_t shebang_len = 0; sds err = NULL; if (evalExtractShebangFlags(body->ptr, &script_flags, &shebang_len, &err) == C_ERR) { - addReplyErrorSds(c, err); + if (c != NULL) { + addReplyErrorSds(c, err); + } return NULL; }