Core/Scripts: Fixed possible crashes in instance scripts (Icecrown Citadel and Naxxramas)

Scripts/Sunwell Plateau: Fixed crash in Kil'jaeden
Scripts/Icecrown Citadel: Fixed crash in Blood-Queen Lana'thel

Closes issue #5051.
Closes issue #5050.
Closes issue #5035.

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-12-08 17:24:31 +01:00
parent 611dc153b0
commit e4e048ed57
4 changed files with 74 additions and 22 deletions
@@ -724,8 +724,9 @@ public:
if (Speeches[speechCount].timer < SpeechTimer)
{
SpeechTimer = 0;
if (Creature* pSpeechCreature = Unit::GetCreature(*me, pInstance->GetData64(Speeches[speechCount].pCreature)))
DoScriptText(Speeches[speechCount].textid, pSpeechCreature);
if (pInstance)
if (Creature* pSpeechCreature = Unit::GetCreature(*me, pInstance->GetData64(Speeches[speechCount].pCreature)))
DoScriptText(Speeches[speechCount].textid, pSpeechCreature);
if (speechCount == 12)
if (Creature* pAnveena = Unit::GetCreature(*me, pInstance->GetData64(DATA_ANVEENA)))
pAnveena->CastSpell(me, SPELL_SACRIFICE_OF_ANVEENA, false);
@@ -826,18 +827,19 @@ public:
}
break;
case TIMER_ORBS_EMPOWER: //Phase 3
if (Creature* pKalec = Unit::GetCreature(*me, pInstance->GetData64(DATA_KALECGOS_KJ)))
{
switch (Phase)
if (pInstance)
if (Creature* pKalec = Unit::GetCreature(*me, pInstance->GetData64(DATA_KALECGOS_KJ)))
{
switch (Phase)
{
case PHASE_SACRIFICE:
CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->EmpowerOrb(true);
break;
default:
CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->EmpowerOrb(false);
break;
}
}
}
OrbActivated = true;
TimerIsDeactivated[TIMER_ORBS_EMPOWER] = true;
break;