Fix segfault when trying to access mo->player->mo from SpawnMobj hook

This commit is contained in:
Hanicef 2024-02-10 19:40:27 +01:00
parent 279820cd6c
commit fe75a21bef

View file

@ -10865,6 +10865,7 @@ 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;
va_end(args);
}