]> git.lizzy.rs Git - minetest.git/commitdiff
Auth API: Error when accessed prior to ServerEnv init (#11398)
authorSmallJoker <SmallJoker@users.noreply.github.com>
Wed, 30 Jun 2021 18:42:26 +0000 (20:42 +0200)
committerGitHub <noreply@github.com>
Wed, 30 Jun 2021 18:42:26 +0000 (20:42 +0200)
src/script/lua_api/l_auth.cpp

index 0fc57ba3a71d0d2e00c5bb2292127fc8dd33b1c7..32d8a7411a006bd3c471b7308cb4f5509796e525 100644 (file)
@@ -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();
 }