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

@ -5652,7 +5652,8 @@ void Player::SetFactionVisibleForFactionTemplateId(uint32 FactionTemplateId)
if(!factionTemplateEntry)
return;
SetFactionVisibleForFactionId(factionTemplateEntry->faction);
if(factionTemplateEntry->faction)
SetFactionVisibleForFactionId(factionTemplateEntry->faction);
}
void Player::SetFactionVisibleForFactionId(uint32 FactionId)
@ -18687,7 +18688,7 @@ BGQueueIdBasedOnLevel Player::GetBattleGroundQueueIdFromLevel(BattleGroundTypeId
float Player::GetReputationPriceDiscount( Creature const* pCreature ) const
{
FactionTemplateEntry const* vendor_faction = pCreature->getFactionTemplateEntry();
if(!vendor_faction)
if(!vendor_faction || !vendor_faction->faction)
return 1.0f;
ReputationRank rank = GetReputationRank(vendor_faction->faction);