[7689] Batter EventAI loading checks and fix one from possible crash cases.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
NoFantasy 2009-04-19 23:02:17 +04:00 committed by VladimirMangos
parent f4adf83cd7
commit ee9ea143d1
5 changed files with 40 additions and 15 deletions

View file

@ -910,10 +910,11 @@ void CreatureEventAI::ProcessAction(uint16 type, uint32 param1, uint32 param2, u
else
{
//if not available, use pActionInvoker
Unit* pTarget = GetTargetByType(param2, pActionInvoker);
if (Player* pPlayer = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself())
pPlayer->RewardPlayerAndGroupAtEvent(param1, m_creature);
if (Unit* pTarget = GetTargetByType(param2, pActionInvoker))
{
if (Player* pPlayer = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself())
pPlayer->RewardPlayerAndGroupAtEvent(param1, m_creature);
}
}
}
break;