mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-01-22 01:01:18 +00:00
Fix a rare crash in flyer.c with self->enemy being NULL
This crash was found by DanielGibson, he even guessed the right fix without having a usable coredump. ;) In boss1.bsp Macron is waiting for the player, despawning as soon as the player moves to him. After that the player needs to press 2 buttons, each button triggers 3 flyers. If the player is fast enough, the first bunch of flyers may spawn before macron is despawned. Now there's a small chance that a flyer decides to attack macron... If Macron despwans at the the next frame, self->enemy is set to NULL (Macron is gone) but nevertheless flyer_fire() is called. The correct fix would be to call flyer_fire() before Macron despawns, but that's hard to impossible. So take the easy route and check if self->enemy is not NULL.
This commit is contained in:
parent
548c217da8
commit
5e5217e549
1 changed files with 1 additions and 1 deletions
|
@ -496,7 +496,7 @@ flyer_fire(edict_t *self, int flash_number)
|
|||
vec3_t dir;
|
||||
int effect;
|
||||
|
||||
if (!self)
|
||||
if (!self || !self->enemy)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue