Fix crash when P_ZMovement calls from Lua removes the object

This commit is contained in:
Gustaf Alhäll 2023-07-16 14:19:19 +02:00
parent 9a31064c4a
commit 9a386111e2
No known key found for this signature in database
GPG key ID: 6C1F67D690CDEDFD

View file

@ -1078,7 +1078,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;
}
@ -1106,7 +1107,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;
}