From 2fa941b89177cf91cbbc84700c1d7631aa85bcc2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 9 Aug 2015 00:27:33 +0300 Subject: Add some missing checks to other files found by paranucker. --- src/actormanager.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'src/actormanager.cpp') diff --git a/src/actormanager.cpp b/src/actormanager.cpp index 155d844ce..c046201d1 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -264,19 +264,24 @@ Being *ActorManager::createBeing(const BeingId id, || type == ActorType::Npc) { being->updateFromCache(); - beingHandler->requestNameById(id); + if (beingHandler) + beingHandler->requestNameById(id); if (localPlayer) localPlayer->checkNewName(being); } else if (type == ActorType::Monster) { - if (serverFeatures->haveMonsterName()) + if (serverFeatures && serverFeatures->haveMonsterName()) beingHandler->requestNameById(id); } else if (type == ActorType::Portal) { - if (serverFeatures->haveServerWarpNames()) + if (beingHandler && + serverFeatures && + serverFeatures->haveServerWarpNames()) + { beingHandler->requestNameById(id); + } } if (type == ActorType::Player) { @@ -513,10 +518,13 @@ void ActorManager::findBeingsByPixel(std::vector &beings, ActorSprite *const actor = *it; - if ((being && (being->isAlive() - || (mTargetDeadPlayers && being->getType() == ActorType::Player)) - && (allPlayers == AllPlayers_true || being != localPlayer)) - || actor->getType() == ActorType::FloorItem) + if ((being && + (being->isAlive() || + (mTargetDeadPlayers && + being->getType() == ActorType::Player)) && + (allPlayers == AllPlayers_true || + being != localPlayer)) || + actor->getType() == ActorType::FloorItem) { if ((actor->getPixelX() - xtol <= x) && (actor->getPixelX() + xtol > x) && @@ -834,9 +842,6 @@ void ActorManager::logic() FOR_EACH (ActorSpritesConstIterator, it, mDeleteActors) { const ActorSprite *const actor = *it; - if (!actor) - continue; - const ActorTypeT &type = actor->getType(); if (type == ActorType::Player) { @@ -1855,7 +1860,7 @@ void ActorManager::updateBadges() for_actors { ActorSprite *const actor = *it; - if (actor && actor->getType() == ActorType::Player) + if (actor->getType() == ActorType::Player) { Being *const being = static_cast(actor); being->showBadges(showBadges); @@ -1869,7 +1874,7 @@ void ActorManager::removeRoom(const int chatId) for_actors { ActorSprite *const actor = *it; - if (actor && actor->getType() == ActorType::Npc) + if (actor->getType() == ActorType::Npc) { Being *const being = static_cast(actor); const ChatObject *const chat = being->getChat(); @@ -1889,7 +1894,7 @@ void ActorManager::updateRoom(const ChatObject *const newChat) for_actors { ActorSprite *const actor = *it; - if (actor && actor->getType() == ActorType::Npc) + if (actor->getType() == ActorType::Npc) { Being *const being = static_cast(actor); ChatObject *const chat = being->getChat(); -- cgit v1.2.3-70-g09d2