From 5447354a76487091b4aeb16698ab1284113a0a29 Mon Sep 17 00:00:00 2001 From: Yamagi Burmeister Date: Thu, 7 Sep 2017 18:12:41 +0200 Subject: [PATCH] Fix a potential crash in ai_run_melee() and ai_run_missile(). This was found and fixed by Maraakate. --- src/g_ai.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/g_ai.c b/src/g_ai.c index f3cf829..f796f3a 100644 --- a/src/g_ai.c +++ b/src/g_ai.c @@ -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; + } } }