Skip to content

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

Hanicef requested to merge Hanicef/SRB2:fix-nil-mo-spawnmobj-hook into next

Due to a symmetry flaw in the MobjSpawn hook, accessing mo->player->mo when an MT_PLAYER is spawning will cause the game to segfault. This was caused by the spawn logic not setting mobj->player->mo when setting mobj->player, thus causing mobj->player->mo to remain NULL when SpawnHook was invoked. The fix sets both values at the same time, thus fixing the issue.

Fixes #1189 (closed)

Merge request reports

Loading