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
1 changed files with 9 additions and 4 deletions

View File

@ -834,11 +834,14 @@ ai_run_melee(edict_t *self)
M_ChangeYaw(self);
if (FacingIdeal(self))
{
if (self->monsterinfo.melee)
{
self->monsterinfo.melee(self);
self->monsterinfo.attack_state = AS_STRAIGHT;
}
}
}
/*
* Turn in place until within
@ -857,10 +860,12 @@ ai_run_missile(edict_t *self)
if (FacingIdeal(self))
{
if (self->monsterinfo.attack) {
self->monsterinfo.attack(self);
self->monsterinfo.attack_state = AS_STRAIGHT;
}
}
}
/*
* Strafe sideways, but stay