Skip to content

Commit

Permalink
Fix crash when attacking monster being raised
Browse files Browse the repository at this point in the history
Fix a potential crash when shooting at a monster being resurrected by an
Arch-Vile. Target could be null in P_CheckMeleeRange(). This fixes issue
#41. Thank you to moggimus for reporting this one! :)
  • Loading branch information
bradharding committed Jun 30, 2014
1 parent 9224eb3 commit 80eb280
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/p_enemy.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@ void P_NoiseAlert(mobj_t *target, mobj_t *emmiter)
boolean P_CheckMeleeRange(mobj_t *actor)
{
mobj_t *pl = actor->target;
fixed_t dist = P_ApproxDistance(pl->x - actor->x, pl->y - actor->y);
fixed_t dist;

if (!pl)
return false;

dist = P_ApproxDistance(pl->x - actor->x, pl->y - actor->y);

if (dist >= MELEERANGE - 20 * FRACUNIT + pl->info->radius)
return false;
Expand Down

0 comments on commit 80eb280

Please sign in to comment.