mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 16:13:46 +01:00
Fix a rare crash case un SendPlayerHP
If the player is disconnected while Lua API is doing a l_punch call, for example, the playersao is NULL and the server crash. Fix it.
This commit is contained in:
parent
0a413265cb
commit
ce8a9ed94b
@ -1802,7 +1802,11 @@ void Server::SendPlayerHP(u16 peer_id)
|
||||
{
|
||||
DSTACK(__FUNCTION_NAME);
|
||||
PlayerSAO *playersao = getPlayerSAO(peer_id);
|
||||
assert(playersao);
|
||||
// In some rare case, if the player is disconnected
|
||||
// while Lua call l_punch, for example, this can be NULL
|
||||
if (!playersao)
|
||||
return;
|
||||
|
||||
SendHP(peer_id, playersao->getHP());
|
||||
m_script->player_event(playersao,"health_changed");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user