mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[10927] Prevent null-pointer dereference in AI calls
This commit is contained in:
parent
1031f3b5d2
commit
d400f00224
2 changed files with 10 additions and 6 deletions
|
|
@ -456,7 +456,8 @@ void Creature::Update(uint32 update_diff, uint32 diff)
|
|||
SetDeathState( JUST_ALIVED );
|
||||
|
||||
//Call AI respawn virtual function
|
||||
i_AI->JustRespawned();
|
||||
if (AI())
|
||||
AI()->JustRespawned();
|
||||
|
||||
GetMap()->Add(this);
|
||||
}
|
||||
|
|
@ -529,10 +530,13 @@ void Creature::Update(uint32 update_diff, uint32 diff)
|
|||
|
||||
if(!IsInEvadeMode())
|
||||
{
|
||||
// do not allow the AI to be changed during update
|
||||
m_AI_locked = true;
|
||||
i_AI->UpdateAI(diff); // AI not react good at real update delays (while freeze in non-active part of map)
|
||||
m_AI_locked = false;
|
||||
if (AI())
|
||||
{
|
||||
// do not allow the AI to be changed during update
|
||||
m_AI_locked = true;
|
||||
AI()->UpdateAI(diff); // AI not react good at real update delays (while freeze in non-active part of map)
|
||||
m_AI_locked = false;
|
||||
}
|
||||
}
|
||||
|
||||
// creature can be dead after UpdateAI call
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue