Fix segfault when passing NULL as player

This commit is contained in:
Hanicef 2024-03-05 18:29:07 +01:00
parent b3aa23bc21
commit 51e912e87b

View file

@ -10886,7 +10886,8 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...)
// when spawning MT_PLAYER, set mobj->player before calling MobjSpawn hook to prevent P_RemoveMobj from succeeding on player mobj.
va_start(args, type);
mobj->player = va_arg(args, player_t *);
mobj->player->mo = mobj;
if (mobj->player)
mobj->player->mo = mobj;
va_end(args);
}