Lua API: Unify server env checks and fix missing ones (#16457)
A few functions tried to dereference a ServerEnvironment nullptr by calling 'getEnv()'. This change makes use of a macro where possible. This also cleans up incorrect macro uses, with no functional difference.
This commit is contained in:
@@ -44,8 +44,11 @@
|
||||
#define GET_ENV_PTR_NO_MAP_LOCK \
|
||||
DEBUG_ASSERT_NO_CLIENTAPI; \
|
||||
ServerEnvironment *env = (ServerEnvironment *)getEnv(L); \
|
||||
if (env == NULL) \
|
||||
return 0
|
||||
if (!env) { \
|
||||
log_deprecated(L, "Calling this function during script init is disallowed.", 1); \
|
||||
return 0; \
|
||||
} \
|
||||
((void)0)
|
||||
|
||||
// Retrieve ServerEnvironment pointer as `env`
|
||||
#define GET_ENV_PTR \
|
||||
|
||||
Reference in New Issue
Block a user