From 88408619aad9720cdb91208539a189648c85ff67 Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Sun, 8 Nov 2020 17:33:49 +0100 Subject: [PATCH] Show a console error if the gamestate contains too many tables --- src/lua_script.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lua_script.c b/src/lua_script.c index 6bd1a81c5..c504cc6f3 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -980,8 +980,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);