summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Behaviors/BehaviorAggressive.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2017-08-30 16:13:31 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2017-08-30 16:13:31 +0200
commit48dff0f03c5df964a411e310f8905aaa3c84ac27 (patch)
treefe76a724ce321fabd6cb261a41799b741ca0a394 /src/Mobs/Behaviors/BehaviorAggressive.cpp
parentremoved agressiveMonster (diff)
downloadcuberite-48dff0f03c5df964a411e310f8905aaa3c84ac27.tar
cuberite-48dff0f03c5df964a411e310f8905aaa3c84ac27.tar.gz
cuberite-48dff0f03c5df964a411e310f8905aaa3c84ac27.tar.bz2
cuberite-48dff0f03c5df964a411e310f8905aaa3c84ac27.tar.lz
cuberite-48dff0f03c5df964a411e310f8905aaa3c84ac27.tar.xz
cuberite-48dff0f03c5df964a411e310f8905aaa3c84ac27.tar.zst
cuberite-48dff0f03c5df964a411e310f8905aaa3c84ac27.zip
Diffstat (limited to 'src/Mobs/Behaviors/BehaviorAggressive.cpp')
-rw-r--r--src/Mobs/Behaviors/BehaviorAggressive.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Mobs/Behaviors/BehaviorAggressive.cpp b/src/Mobs/Behaviors/BehaviorAggressive.cpp
index b55c1b476..2e3333e89 100644
--- a/src/Mobs/Behaviors/BehaviorAggressive.cpp
+++ b/src/Mobs/Behaviors/BehaviorAggressive.cpp
@@ -34,6 +34,9 @@ void cBehaviorAggressive::PreTick(std::chrono::milliseconds a_Dt, cChunk & a_Chu
cPawn * cBehaviorAggressive::FindNewTarget()
{
cPlayer * Closest = m_Parent->GetNearestPlayer();
- if (!Closest->CanMobsTarget()) return nullptr;
+ if ((Closest != nullptr) && (!Closest->CanMobsTarget()))
+ {
+ return nullptr;
+ }
return Closest; // May be null
}