]> git.lizzy.rs Git - minetest.git/commitdiff
Fixes #4098 ce8a9ed didn't quite go far enough, and left this bug in
authorgregorycu <gregory.currie@gmail.com>
Sun, 8 May 2016 09:02:11 +0000 (19:02 +1000)
committerCraig Robbins <kde.psych@gmail.com>
Sun, 8 May 2016 09:03:09 +0000 (19:03 +1000)
src/server.cpp

index 0aba2796c27c21d8a83a7425a6ed3870028261ba..a3b686c257050027afc6672d8f6a7d86afd31626 100644 (file)
@@ -1846,7 +1846,7 @@ void Server::SendPlayerHP(u16 peer_id)
 {
        DSTACK(FUNCTION_NAME);
        PlayerSAO *playersao = getPlayerSAO(peer_id);
-       // In some rare case, if the player is disconnected
+       // In some rare case if the player is disconnected
        // while Lua call l_punch, for example, this can be NULL
        if (!playersao)
                return;
@@ -2515,9 +2515,11 @@ void Server::sendDetachedInventories(u16 peer_id)
 void Server::DiePlayer(u16 peer_id)
 {
        DSTACK(FUNCTION_NAME);
-
        PlayerSAO *playersao = getPlayerSAO(peer_id);
-       assert(playersao);
+       // In some rare cases this can be NULL -- if the player is disconnected
+       // when a Lua function modifies l_punch, for example
+       if (!playersao)
+               return;
 
        infostream << "Server::DiePlayer(): Player "
                        << playersao->getPlayer()->getName()