Fix a potential crash in ai_run_melee() and ai_run_missile().

This was found and fixed by Maraakate.
This commit is contained in:
Yamagi Burmeister 2017-09-07 18:12:41 +02:00
parent 6f1b2f101f
commit 5447354a76

View file

@ -810,8 +810,11 @@ ai_run_melee(edict_t *self)
if (FacingIdeal(self))
{
self->monsterinfo.melee(self);
self->monsterinfo.attack_state = AS_STRAIGHT;
if (self->monsterinfo.melee)
{
self->monsterinfo.melee(self);
self->monsterinfo.attack_state = AS_STRAIGHT;
}
}
}
@ -827,8 +830,11 @@ ai_run_missile(edict_t *self)
if (FacingIdeal(self))
{
self->monsterinfo.attack(self);
self->monsterinfo.attack_state = AS_STRAIGHT;
if (self->monsterinfo.attack)
{
self->monsterinfo.attack(self);
self->monsterinfo.attack_state = AS_STRAIGHT;
}
}
}