Skip to content

Commit 062fd21

Browse files
authoredJun 30, 2021
Auth API: Error when accessed prior to ServerEnv init (#11398)
1 parent 827a785 commit 062fd21

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

Diff for: ‎src/script/lua_api/l_auth.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ AuthDatabase *ModApiAuth::getAuthDb(lua_State *L)
3232
{
3333
ServerEnvironment *server_environment =
3434
dynamic_cast<ServerEnvironment *>(getEnv(L));
35-
if (!server_environment)
35+
if (!server_environment) {
36+
luaL_error(L, "Attempt to access an auth function but the auth"
37+
" system is yet not initialized. This causes bugs.");
3638
return nullptr;
39+
}
3740
return server_environment->getAuthDatabase();
3841
}
3942

0 commit comments

Comments
 (0)