Core/GameObjects: Fixed crashes in GameObject::SetLootState and GameObject::SetGoState for summoned objects

Closes #5166
This commit is contained in:
Shauren
2012-02-10 10:24:56 +01:00
parent 5365bd25fa
commit 806733550c
@@ -1902,7 +1902,7 @@ void GameObject::SetLootState(LootState state, Unit* unit)
// startOpen determines whether we are going to add or remove the LoS on activation
bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
if (GetGOData()->go_state == GO_NOT_READY)
if (GetGOData() && GetGOData()->go_state == GO_NOT_READY)
startOpen = !startOpen;
if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED)
@@ -1923,7 +1923,7 @@ void GameObject::SetGoState(GOState state)
// startOpen determines whether we are going to add or remove the LoS on activation
bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
if (GetGOData()->go_state == GO_NOT_READY)
if (GetGOData() && GetGOData()->go_state == GO_NOT_READY)
startOpen = !startOpen;
if (state == GO_STATE_ACTIVE || state == GO_STATE_ACTIVE_ALTERNATIVE)