From 8a8db796beeaafe1bc1a532c73bf841170d5c005 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 7 Sep 2024 17:30:00 +0200 Subject: [PATCH] Show a console error if the gamestate contains too many tables --- src/d_clisrv.c | 1 - src/lua_script.c | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 3b7c08a0a..8c10bcf55 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2642,7 +2642,6 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic // Call it only once by tic if (*oldtic != I_GetTime()) { - INT32 key; I_OsPolling(); diff --git a/src/lua_script.c b/src/lua_script.c index c4a0df135..9d5bef4a7 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -670,8 +670,17 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) lua_pop(gL, 1); } if (!found) + { t++; + if (t == 0) + { + CONS_Alert(CONS_ERROR, "Too many tables to archive!\n"); + WRITEUINT8(save_p, ARCH_NULL); + return 0; + } + } + WRITEUINT8(save_p, ARCH_TABLE); WRITEUINT16(save_p, t);