mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[11107] Fixed possible crash in CreatureEventAI melee attack proccessing.
Added target check to CreatureEventAI::DoMeleeAttackIfReady, but crash possible as result proccesing in caller function before melee attack different EventAI events that possible can remove combat state or target.
This commit is contained in:
parent
2f1410f1ff
commit
8c5ce115c9
2 changed files with 15 additions and 11 deletions
|
|
@ -1366,16 +1366,20 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit*
|
|||
|
||||
void CreatureEventAI::DoMeleeAttackIfReady()
|
||||
{
|
||||
//Make sure our attack is ready before checking distance
|
||||
if (m_creature->isAttackReady())
|
||||
{
|
||||
//If we are within range melee the target
|
||||
if (m_creature->CanReachWithMeleeAttack(m_creature->getVictim()))
|
||||
{
|
||||
// Check target
|
||||
if (!m_creature->getVictim())
|
||||
return;
|
||||
|
||||
// Make sure our attack is ready before checking distance
|
||||
if (!m_creature->isAttackReady())
|
||||
return;
|
||||
|
||||
// If we are within range melee the target
|
||||
if (!m_creature->CanReachWithMeleeAttack(m_creature->getVictim()))
|
||||
return;
|
||||
|
||||
m_creature->AttackerStateUpdate(m_creature->getVictim());
|
||||
m_creature->resetAttackTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11106"
|
||||
#define REVISION_NR "11107"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue