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:07:42 +02:00
parent 99a032c6ae
commit a9b24bfa04

View file

@ -835,8 +835,11 @@ ai_run_melee(edict_t *self)
if (FacingIdeal(self)) if (FacingIdeal(self))
{ {
self->monsterinfo.melee(self); if (self->monsterinfo.melee)
self->monsterinfo.attack_state = AS_STRAIGHT; {
self->monsterinfo.melee(self);
self->monsterinfo.attack_state = AS_STRAIGHT;
}
} }
} }
@ -857,8 +860,10 @@ ai_run_missile(edict_t *self)
if (FacingIdeal(self)) if (FacingIdeal(self))
{ {
self->monsterinfo.attack(self); if (self->monsterinfo.attack) {
self->monsterinfo.attack_state = AS_STRAIGHT; self->monsterinfo.attack(self);
self->monsterinfo.attack_state = AS_STRAIGHT;
}
} }
} }