Merge branch 'fix-zmovement-remove-crash' into 'next'

Fix crash when P_ZMovement calls from Lua removes the object

See merge request STJr/SRB2!2054
This commit is contained in:
Sal 2023-07-26 12:09:05 +00:00
commit e96a1630b5

View file

@ -1079,7 +1079,8 @@ static int lib_pZMovement(lua_State *L)
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_ZMovement(actor));
P_CheckPosition(actor, actor->x, actor->y);
if (!P_MobjWasRemoved(actor))
P_CheckPosition(actor, actor->x, actor->y);
P_SetTarget(&tmthing, ptmthing);
return 1;
}
@ -1107,7 +1108,8 @@ static int lib_pSceneryZMovement(lua_State *L)
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_SceneryZMovement(actor));
P_CheckPosition(actor, actor->x, actor->y);
if (!P_MobjWasRemoved(actor))
P_CheckPosition(actor, actor->x, actor->y);
P_SetTarget(&tmthing, ptmthing);
return 1;
}