factionTemplate->faction can be 0, add appropriate checks to prevent crashes and unexpected work.

This commit is contained in:
VladimirMangos 2009-03-03 17:09:58 +03:00
parent 3ab8264189
commit 03273a49da
4 changed files with 73 additions and 44 deletions

View file

@ -84,7 +84,7 @@ ObjectAccessor::GetNPCIfCanInteractWith(Player const &player, uint64 guid, uint3
if(factionTemplate)
{
FactionEntry const* faction = sFactionStore.LookupEntry(factionTemplate->faction);
if( faction->reputationListID >= 0 && player.GetReputationRank(faction) <= REP_UNFRIENDLY)
if( faction && faction->reputationListID >= 0 && player.GetReputationRank(faction) <= REP_UNFRIENDLY)
return NULL;
}