From 8c12227687454abe5bdd0b8796f84f15fd3817d8 Mon Sep 17 00:00:00 2001 From: LogicParrot Date: Sat, 16 Jan 2016 14:16:47 +0200 Subject: Fix crash when tamed wolf is hit by arrows --- src/Mobs/Wolf.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/Mobs/Wolf.cpp') diff --git a/src/Mobs/Wolf.cpp b/src/Mobs/Wolf.cpp index e074cfe2e..174fee9b1 100644 --- a/src/Mobs/Wolf.cpp +++ b/src/Mobs/Wolf.cpp @@ -73,8 +73,12 @@ bool cWolf::Attack(std::chrono::milliseconds a_Dt) -void cWolf::NearbyPlayerIsFighting(cPlayer * a_Player, cEntity * a_Opponent) +void cWolf::NearbyPlayerIsFighting(cPlayer * a_Player, cPawn * a_Opponent) { + if (a_Opponent == nullptr) + { + return; + } if ((m_Target == nullptr) && (a_Player->GetName() == m_OwnerName) && !IsSitting() && (a_Opponent->IsPawn())) { m_Target = a_Opponent; -- cgit v1.2.3