diff options
Diffstat (limited to 'src/game/GameObject.cpp')
-rw-r--r-- | src/game/GameObject.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 6119ecc87be..a4d31a19c67 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -1576,11 +1576,13 @@ void GameObject::TakenDamage(uint32 damage, Unit *who) return; Player* pwho = NULL; - if (who && who->GetTypeId() == TYPEID_PLAYER) - pwho = who->ToPlayer(); - - if (who && who->IsVehicle()) - pwho = who->GetCharmerOrOwner()->ToPlayer(); + if (who) + { + if (who->GetTypeId() == TYPEID_PLAYER) + pwho = who->ToPlayer(); + else if (who->IsVehicle() && who->GetCharmerOrOwner()) + pwho = who->GetCharmerOrOwner()->ToPlayer(); + } if (m_goValue->building.health > damage) m_goValue->building.health -= damage; |