Fix segfault when removing mobjs while iterating thinglist

This commit is contained in:
Alug committed 2024-02-17 16:49:55 +01:00
1 parent e615604adf
commit e30b54a149
1 file changed
+2
+2
View File
@@ -268,6 +268,8 @@ static int lib_iterateSectorThinglist(lua_State *L)
if (!lua_isnil(L, 1))
{
thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
if (P_MobjWasRemoved(thing))
return luaL_error(L, "current entry in thinglist was removed; avoid calling P_RemoveMobj on entries!");
thing = thing->snext;
}
else