aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/lua_api')
-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();
}