Skip to content
Browse files

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.
  • Loading branch information
nerzhul committed Apr 11, 2015
1 parent 0a41326 commit ce8a9ed94b7a3a4cbce04bee27bf8d4167ac6161
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/server.cpp
@@ -1802,7 +1802,11 @@ void Server::SendPlayerHP(u16 peer_id)
PlayerSAO *playersao = getPlayerSAO(peer_id);
// In some rare case, if the player is disconnected
// while Lua call l_punch, for example, this can be NULL
if (!playersao)

SendHP(peer_id, playersao->getHP());

0 comments on commit ce8a9ed

Please sign in to comment.