From 55248e7fcf5e79fca5d8b7d3aef2de6c42c9bb1d Mon Sep 17 00:00:00 2001 From: Indev Date: Sun, 19 May 2024 13:45:34 +0300 Subject: [PATCH] Attempt to fix a lua panic when unarchiveing extvars (print error to console instead. Not sure if it would be safe for game to read from save afterwards though) --- src/lua_script.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lua_script.c b/src/lua_script.c index 9d5bef4a7..c6df314d4 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -1460,7 +1460,13 @@ static void UnArchiveExtVars(void *pointer) for (i = 0; i < field_count; i++) { READSTRING(save_p, field); - UnArchiveValue(TABLESINDEX); + + if (UnArchiveValue(TABLESINDEX) == 1) + { + CONS_Alert(CONS_ERROR, "Unexpected end marker when reading ExtVars (field '%s')\n", field); + break; + } + lua_setfield(gL, -2, field); }