From f45129878477b706f7e40814821deff30fdb27ae Mon Sep 17 00:00:00 2001 From: ApoC Date: Sat, 24 Oct 2009 14:00:40 +0200 Subject: [PATCH] [8722] Fixed possible creash. Crash may happen if you try summon pet by spell and certain NPC is not in your DB (than CreatureInfo* is NULL). Signed-off-by: ApoC --- src/game/Unit.cpp | 3 ++- src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index de5669324..309c09875 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -9603,7 +9603,8 @@ void Unit::ClearInCombat() // Player's state will be cleared in Player::UpdateContestedPvP if (GetTypeId() != TYPEID_PLAYER) { - if (((Creature*)this)->GetCreatureInfo()->unit_flags & UNIT_FLAG_OOC_NOT_ATTACKABLE) + Creature* creature = (Creature*)this; + if (creature->GetCreatureInfo() && creature->GetCreatureInfo()->unit_flags & UNIT_FLAG_OOC_NOT_ATTACKABLE) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); clearUnitState(UNIT_STAT_ATTACK_PLAYER); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 6a43c57a9..fcf402369 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8721" + #define REVISION_NR "8722" #endif // __REVISION_NR_H__