summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2021-06-30 20:42:26 +0200
committerGitHub <noreply@github.com>2021-06-30 20:42:26 +0200
commit062fd2190e0ac617499b19c51db609d3a923347e (patch)
tree5e576327a3356d001f7089ee8357f3abce3d8259 /src
parent827a7852e2ac4abfe548fe193b8ed380d5c46d86 (diff)
downloadminetest-062fd2190e0ac617499b19c51db609d3a923347e.tar.gz
minetest-062fd2190e0ac617499b19c51db609d3a923347e.tar.bz2
minetest-062fd2190e0ac617499b19c51db609d3a923347e.zip
Auth API: Error when accessed prior to ServerEnv init (#11398)
Diffstat (limited to 'src')
-rw-r--r--src/script/lua_api/l_auth.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/script/lua_api/l_auth.cpp b/src/script/lua_api/l_auth.cpp
index 0fc57ba3a..32d8a7411 100644
--- a/src/script/lua_api/l_auth.cpp
+++ b/src/script/lua_api/l_auth.cpp
@@ -32,8 +32,11 @@ AuthDatabase *ModApiAuth::getAuthDb(lua_State *L)
{
ServerEnvironment *server_environment =
dynamic_cast<ServerEnvironment *>(getEnv(L));
- if (!server_environment)
+ if (!server_environment) {
+ luaL_error(L, "Attempt to access an auth function but the auth"
+ " system is yet not initialized. This causes bugs.");
return nullptr;
+ }
return server_environment->getAuthDatabase();
}