diff --git a/src/game/GameObject.h b/src/game/GameObject.h index 61df6e0e42..0d5718a49f 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -501,6 +501,14 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject void SetOwnerGUID(uint64 owner) { + // Owner already found and different than expected owner - remove object from old owner + if (owner && GetOwnerGUID() && GetOwnerGUID() != owner) + { + if (Unit* owner = GetOwner()) + owner->RemoveGameObject(this, false); + else + assert(false); + } m_spawnedByDefault = false; // all object with owner is despawned after delay SetUInt64Value(OBJECT_FIELD_CREATED_BY, owner); }