diff options
author | megamage <none@none> | 2008-11-02 08:44:15 -0600 |
---|---|---|
committer | megamage <none@none> | 2008-11-02 08:44:15 -0600 |
commit | c10a9e6cccd0ff2a43003916a859171387c7e591 (patch) | |
tree | aa640c8e7698e13e8f999af356985c591bb75335 /src/game/GameObject.cpp | |
parent | 972e2d56e2c9139340f7f2bda31ded5e1696c70d (diff) |
[svn] Fix a bug that GameObject::CastSpell crash the server.
--HG--
branch : trunk
Diffstat (limited to 'src/game/GameObject.cpp')
-rw-r--r-- | src/game/GameObject.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 57d206fa1aa..fbeb30144bb 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -1271,9 +1271,15 @@ void GameObject::CastSpell(Unit* target, uint32 spell) Creature *trigger = SummonCreature(12999, GetPositionX(), GetPositionY(), GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 1); if(!trigger) return; - Unit *owner = GetOwner(); - if(owner) trigger->setFaction(owner->getFaction()); - else trigger->setFaction(14); trigger->SetVisibility(VISIBILITY_OFF); //should this be true? - trigger->CastSpell(target, spell, true, 0, 0, owner->GetGUID()); + if(Unit *owner = GetOwner()) + { + trigger->setFaction(owner->getFaction()); + trigger->CastSpell(target, spell, true, 0, 0, owner->GetGUID()); + } + else + { + trigger->setFaction(14); + trigger->CastSpell(target, spell, true); + } }
\ No newline at end of file |