Navigation Menu

Skip to content

Commit

Permalink
Auth API: Error when accessed prior to ServerEnv init (minetest#11398)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmallJoker committed Jun 30, 2021
1 parent 827a785 commit 062fd21
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/script/lua_api/l_auth.cpp
Expand Up @@ -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();
}

Expand Down

0 comments on commit 062fd21

Please sign in to comment.