Fix segfault when destroying wall spike while it moves
This patch fixed a segfault that triggers when a wall spike is destroyed while it's either expanding or contracting. This happens because of the spike's state changes to S_NULL
which removes the mobj, but no logic exists to handle cases where the mobj is removed while it's is the process of changing state.
The easiest way to reproduce this issue is in CEZ2 as Amy. At the beginning where the ground falls apart, go down and land on one of the upper platforms where there are moving spikes. Then, try to time Amy's hammer to break the spikes while it's either expanding or contracting, and if timed correctly, the game will crash (I recommend doing this with a build compiled with DEBUGMODE=1
, since the bug doesn't trigger consistently otherwise).
Edited by Hanicef