aboutsummaryrefslogtreecommitdiff
path: root/src/game/GameObject.cpp
diff options
context:
space:
mode:
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
{