From c113bf884f9523745f22aae78cde80903b2ba192 Mon Sep 17 00:00:00 2001 From: megamage Date: Tue, 3 Mar 2009 16:18:22 -0600 Subject: factionTemplate->faction can be 0, add appropriate checks to prevent crashes and unexpected work. Author: VladimirMangos --HG-- branch : trunk --- src/game/Player.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/game/Player.cpp') diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 5d0f4c4e598..ac261b90529 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -5757,7 +5757,8 @@ void Player::SetFactionVisibleForFactionTemplateId(uint32 FactionTemplateId) if(!factionTemplateEntry) return; - SetFactionVisibleForFactionId(factionTemplateEntry->faction); + if(factionTemplateEntry->faction) + SetFactionVisibleForFactionId(factionTemplateEntry->faction); } void Player::SetFactionVisibleForFactionId(uint32 FactionId) @@ -19247,7 +19248,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); -- cgit v1.2.3