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)

https://github.com/alufolie91/saturn-32p/commit/a770ecdbd4afd56a9d8325eae47f0c69f71661ee#diff-0c6396d5a9ad45f461741cd44ffb2c0d3cf0eb2ec7b0500053005196fe53f1a6R1462
This commit is contained in:
Alug committed 2024-10-12 22:09:15 +02:00
1 parent 3b01393a71
commit 7f1217b2ab
1 file changed
+7 -1
+7 -1
View File
@@ -1149,7 +1149,13 @@ static void UnArchiveExtVars(UINT8 **p, void *pointer, boolean network)
for (i = 0; i < field_count; i++)
{
READSTRING(*p, field);
UnArchiveValue(p, TABLESINDEX);
if (UnArchiveValue(p, TABLESINDEX) == 1)
{
CONS_Alert(CONS_ERROR, "Unexpected end marker when reading ExtVars (field '%s')\n", field);
break;
}
lua_setfield(gL, -2, field);
}
}