Skip to content
Snippets Groups Projects

Fix crash when P_ZMovement calls from Lua removes the object

Merged Hanicef requested to merge Hanicef/SRB2Classic:fix-zmovement-remove-crash into next

If P_ZMovement or P_SceneryZMovement is called from Lua where the object's state is set for removal in the call function, the game crashes. This is caused by a missing P_MobjWasRemoved check within the Lua handlers that follows these native function calls, which causes it to attempt to fetch the object state when there no longer is an object, and thus triggering the crash.

The following Lua script reproduces the issue:

local mo = P_SpawnMobj(0, 0, 0, MT_SMALLBUBBLE)
P_SetOrigin(mo, mo.x, mo.y, mo.ceilingz)
P_SceneryZMovement(mo)

mo = P_SpawnMobj(0, 0, 0, MT_SPIKE)
mo.health = 0
P_SetOrigin(mo, mo.x, mo.y, mo.floorz)
P_ZMovement(mo)

Merge request reports

Checking pipeline status.

Merged by SalSal 1 year ago (Jul 26, 2023 12:09pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading