diff options
author | Lukas Pioch <lukas@zgow.de> | 2016-11-22 18:01:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-22 18:01:57 +0100 |
commit | 852dbe9ab4640d1c295fae941bb89c7889b8faf0 (patch) | |
tree | 4f5d309f5ab7d094db5faa3b4917fafd5506a35b /src | |
parent | Merge pull request #3439 from cuberite/ClientHandleThreading (diff) | |
parent | cWolf: Fixed targetting a nullptr. (diff) | |
download | cuberite-852dbe9ab4640d1c295fae941bb89c7889b8faf0.tar cuberite-852dbe9ab4640d1c295fae941bb89c7889b8faf0.tar.gz cuberite-852dbe9ab4640d1c295fae941bb89c7889b8faf0.tar.bz2 cuberite-852dbe9ab4640d1c295fae941bb89c7889b8faf0.tar.lz cuberite-852dbe9ab4640d1c295fae941bb89c7889b8faf0.tar.xz cuberite-852dbe9ab4640d1c295fae941bb89c7889b8faf0.tar.zst cuberite-852dbe9ab4640d1c295fae941bb89c7889b8faf0.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/Mobs/Wolf.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Mobs/Wolf.cpp b/src/Mobs/Wolf.cpp index e62ec6c30..6751cd7c7 100644 --- a/src/Mobs/Wolf.cpp +++ b/src/Mobs/Wolf.cpp @@ -38,11 +38,12 @@ bool cWolf::DoTakeDamage(TakeDamageInfo & a_TDI) if ((a_TDI.Attacker != nullptr) && a_TDI.Attacker->IsPawn()) { - if (GetTarget()->IsPlayer()) + auto currTarget = GetTarget(); + if ((currTarget != nullptr) && currTarget->IsPlayer()) { if (m_IsTame) { - if ((static_cast<cPlayer*>(GetTarget())->GetUUID() == m_OwnerUUID)) + if ((static_cast<cPlayer*>(currTarget)->GetUUID() == m_OwnerUUID)) { SetTarget(PreviousTarget); // Do not attack owner } @@ -64,7 +65,6 @@ bool cWolf::DoTakeDamage(TakeDamageInfo & a_TDI) } } - m_World->BroadcastEntityMetadata(*this); // Broadcast health and possibly angry face return true; } |