Skip to content

Fix segfault when Crushstaceans hit a player with Armageddon shield

Hanicef requested to merge Hanicef/SRB2:fix-crushclaw-armageddon-hit into next

If a Crushstacean hits a player with an Armageddon shield, there's a risk that the game crashes. This is caused by the Armageddon shield firing off as soon as the player is hit by the Crushstacies, thus killing it, but the logic for the Crushclaw still runs afterwards. The game will then keep running the check normally due to a NULL check that should actually be checked with P_MobjWasRemoved, since the Crushclaw won't be removed until after it's thinking logic is invoked (the Crushstacean still had a trace reference against the Crushclaw, delaying it's removal).

The bug can be easily reproduced on DCZ1 by going behind the left pillar at the start to get the Armageddon shield and then taking the left path to the Crushstacean. Just get hit by it's claw, and the game might crash (note that it's not consistent, even in debug builds, so you might need to try a couple of times until the crash actually triggers).

Merge request reports