diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/script/cpp_api/s_env.cpp | 3 | ||||
-rw-r--r-- | src/server.cpp | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/script/cpp_api/s_env.cpp b/src/script/cpp_api/s_env.cpp index 9ac9302ac..4b5feee96 100644 --- a/src/script/cpp_api/s_env.cpp +++ b/src/script/cpp_api/s_env.cpp @@ -61,6 +61,9 @@ void ScriptApiEnv::environment_Step(float dtime) void ScriptApiEnv::player_event(ServerActiveObject* player, std::string type) { SCRIPTAPI_PRECHECKHEADER + + if (player == NULL) + return; // Get minetest.registered_playerevents lua_getglobal(L, "minetest"); diff --git a/src/server.cpp b/src/server.cpp index 40857f84d..920b9aa2d 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -4580,8 +4580,13 @@ bool Server::hudSetFlags(Player *player, u32 flags, u32 mask) { SendHUDSetFlags(player->peer_id, flags, mask); player->hud_flags = flags; + + PlayerSAO* playersao = player->getPlayerSAO(); + + if (playersao == NULL) + return false; - m_script->player_event(player->getPlayerSAO(),"hud_changed"); + m_script->player_event(playersao, "hud_changed"); return true; } |