Skip to content

Fix segfault when accessing skin from lua on a delayed removal

Hanicef requested to merge Hanicef/SRB2:fix-mobj-skin-segfault into next

Oh man has it been a while since I fixed one of these bugs.

If a Lua script accesses an mobj's skin flag if it's removal has been delayed, the game can segfault. This is due to ye olde missing P_MobjWasRemoved checked that used to plague the game back in 2.2.10. Adding these checks instead of just checking for NULL fixes the problem.

For anyone unfamiliar with these kinds of bugs: this bug can be triggered consistently on a debug build, so make sure to use that if you want to test it!

Merge request reports

Loading