aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSpp <none@none>2010-05-09 21:32:49 +0200
committerSpp <none@none>2010-05-09 21:32:49 +0200
commit3b3f0caa69c9df629b6ab0793b50d20bd2f03ac6 (patch)
treeb221244f0b53d9b81e2a4b4267ec59d47ee00b1e /src
parent02dfc46849f468045dc4b68f900b29b63adc2dcd (diff)
Fix a crash in GameObject::TakenDamage
Fixes issue 2082 --HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/GameObject.cpp12
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;