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 );
|
SetDeathState( JUST_ALIVED );
|
||||||
|
|
||||||
//Call AI respawn virtual function
|
//Call AI respawn virtual function
|
||||||
i_AI->JustRespawned();
|
if (AI())
|
||||||
|
AI()->JustRespawned();
|
||||||
|
|
||||||
GetMap()->Add(this);
|
GetMap()->Add(this);
|
||||||
}
|
}
|
||||||
|
|
@ -529,10 +530,13 @@ void Creature::Update(uint32 update_diff, uint32 diff)
|
||||||
|
|
||||||
if(!IsInEvadeMode())
|
if(!IsInEvadeMode())
|
||||||
{
|
{
|
||||||
// do not allow the AI to be changed during update
|
if (AI())
|
||||||
m_AI_locked = true;
|
{
|
||||||
i_AI->UpdateAI(diff); // AI not react good at real update delays (while freeze in non-active part of map)
|
// do not allow the AI to be changed during update
|
||||||
m_AI_locked = false;
|
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
|
// creature can be dead after UpdateAI call
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10926"
|
#define REVISION_NR "10927"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue