aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 6597ee64f..4d5938205 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -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");