replace those two P_MobjWasRemoved with simple null check insteead

since those may actually segfault if null anyways
This commit is contained in:
Alug committed 2024-10-21 06:23:05 +02:00
1 parent 4213bffab0
commit 9808d123cd
2 files changed
+4 -3

No files matched your search

+1 -1
View File
@@ -281,7 +281,7 @@ 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))
if (!thing)
return luaL_error(L, "current entry in thinglist was removed; avoid calling P_RemoveMobj on entries!");
thing = thing->snext;
}
+3 -2
View File
@@ -3384,7 +3384,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
I_Assert(mobj->player != NULL);
I_Assert(!P_MobjWasRemoved(mobj));
if (P_MobjWasRemoved(mobj))
if (!mobj)
return;
P_MobjCheckWater(mobj);
@@ -11126,7 +11126,8 @@ void P_SpawnMapThing(mapthing_t *mthing)
mobj = P_SpawnMobj(x, y, z, i);
if (!mobj || P_MobjWasRemoved(mobj)) {
if (!mobj || P_MobjWasRemoved(mobj))
{
CONS_Alert(CONS_ERROR, "Failed to spawn map thing #%d at %d, %d. This will crash vanilla clients!\n", mthing->type, x>>FRACBITS, y>>FRACBITS);
return;
}