Skip to content
Snippets Groups Projects
Commit 608e236d authored by Hanicef's avatar Hanicef
Browse files

Fix segfault when accessing skin from lua on a delayed removal

parent baec79e0
No related branches found
No related tags found
No related merge requests found
...@@ -198,12 +198,12 @@ static int mobj_get(lua_State *L) ...@@ -198,12 +198,12 @@ static int mobj_get(lua_State *L)
enum mobj_e field = Lua_optoption(L, 2, -1, mobj_fields_ref); enum mobj_e field = Lua_optoption(L, 2, -1, mobj_fields_ref);
lua_settop(L, 2); lua_settop(L, 2);
if (!mo || !ISINLEVEL) { if (P_MobjWasRemoved(mo) || !ISINLEVEL) {
if (field == mobj_valid) { if (field == mobj_valid) {
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
return 1; return 1;
} }
if (!mo) { if (P_MobjWasRemoved(mo)) {
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
} else } else
return luaL_error(L, "Do not access an mobj_t field outside a level!"); return luaL_error(L, "Do not access an mobj_t field outside a level!");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment