Skip to content
Permalink
Browse files
Auth API: Error when accessed prior to ServerEnv init (#11398)
  • Loading branch information
SmallJoker committed Jun 30, 2021
1 parent 827a785 commit 062fd2190e0ac617499b19c51db609d3a923347e
Showing with 4 additions and 1 deletion.
  1. +4 −1 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();
}

0 comments on commit 062fd21

Please sign in to comment.