Skip to content

Fix segfault when P_RemoveMobj is called within A_FaceTarget action

Hanicef requested to merge Hanicef/SRB2:fix-remove-facetarget-action into next

While looking at !1970 (merged), I accidentally discovered a segfault caused by calls to P_RemoveMobj within the A_FaceTarget action. As usual with these issues, pretty much all calls to A_FaceTarget in the code were missing a following P_MobjWasRemoved check, which could segfault the game in some cases.

It can easily be triggered with this Lua script on CEZ1 by simply grabbing the attention from a Robo-Hood, for example:

function A_FaceTarget(mobj)
    P_RemoveMobj(mobj)
end

Merge request reports

Loading