From f545cce6febaf2bb3a7d688d8d7f9d5d87053ced Mon Sep 17 00:00:00 2001 From: Indev Date: Thu, 25 Jul 2024 22:50:53 +0300 Subject: [PATCH] Add check for if lua state exist in UnArchiveExtVars, since server can have local luas that may add player/mobj fields into savegame --- src/lua_script.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lua_script.c b/src/lua_script.c index 160c92180..6528a515e 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -1432,7 +1432,12 @@ static void UnArchiveExtVars(void *pointer) if (field_count == 0) return; - I_Assert(gL != NULL); + + // Technically possible new, since server may have local lua scripts but no "public" ones, so + // field_count would be non zero (there is no way to tell local field from non-local, so + // everything gets archived) + if (!gL) + return; TABLESINDEX = lua_gettop(gL); lua_createtable(gL, 0, field_count); // pointer's ext vars subtable