Fix segfault when setting privileges of a non-connected player
authorPerttu Ahola <celeron55@gmail.com>
Sat, 7 Apr 2012 15:46:10 +0000 (18:46 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Sat, 7 Apr 2012 15:46:10 +0000 (18:46 +0300)
src/server.cpp

index b33e2477e78f5d692b6a1eaf15148889a04acc86..d7b55a46829b99e60eaafcc937b08514920541e3 100644 (file)
@@ -4322,7 +4322,10 @@ void Server::reportPrivsModified(const std::string &name)
                if(!player)
                        return;
                SendPlayerPrivileges(player->peer_id);
-               player->getPlayerSAO()->updatePrivileges(
+               PlayerSAO *sao = player->getPlayerSAO();
+               if(!sao)
+                       return;
+               sao->updatePrivileges(
                                getPlayerEffectivePrivs(name),
                                isSingleplayer());
        }