aboutsummaryrefslogtreecommitdiff
path: root/src/game/GameObject.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-07-01 18:36:03 -0500
committermegamage <none@none>2009-07-01 18:36:03 -0500
commit4a8a89e1db1f103020ffecbb570e1c570c2e0d21 (patch)
treed5e62fa664a0f36d668f738abc50ac9406d50e5a /src/game/GameObject.cpp
parent111dac5f94eac3fe26da2107842dea4e1aacd660 (diff)
[8103] More wide use IsInWorld checks and delayed at teleport operations. Author: Ambal
* IsInWorld used to prevent return unexpected not in world objects. * Delayed operations need to process its in world state. --HG-- branch : trunk
Diffstat (limited to 'src/game/GameObject.cpp')
-rw-r--r--src/game/GameObject.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
index 85a86f18cdf..d2d8044a322 100644
--- a/src/game/GameObject.cpp
+++ b/src/game/GameObject.cpp
@@ -76,7 +76,13 @@ void GameObject::CleanupsBeforeDelete()
// Possible crash at access to deleted GO in Unit::m_gameobj
if(uint64 owner_guid = GetOwnerGUID())
{
- if(Unit* owner = ObjectAccessor::GetUnit(*this,owner_guid))
+ Unit* owner = NULL;
+ if(IS_PLAYER_GUID(owner_guid))
+ owner = ObjectAccessor::GetObjectInWorld(owner_guid, (Player*)NULL);
+ else
+ owner = ObjectAccessor::GetUnit(*this,owner_guid);
+
+ if(owner)
owner->RemoveGameObject(this,false);
else
{