[Scummvm-git-logs] scummvm branch-2-8 -> daf9b6b23e3a3b17cc9130dfc2453f61ba05fd97

aquadran noreply at scummvm.org
Thu Mar 7 13:26:54 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
daf9b6b23e GRIM: Restore LUA W/A for release. It might still needed for old save games.


Commit: daf9b6b23e3a3b17cc9130dfc2453f61ba05fd97
    https://github.com/scummvm/scummvm/commit/daf9b6b23e3a3b17cc9130dfc2453f61ba05fd97
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2024-03-07T14:26:22+01:00

Commit Message:
GRIM: Restore LUA W/A for release. It might still needed for old save games.

Changed paths:
    engines/grim/lua/ldo.cpp


diff --git a/engines/grim/lua/ldo.cpp b/engines/grim/lua/ldo.cpp
index 1d2a309bfd2..1189598a3b8 100644
--- a/engines/grim/lua/ldo.cpp
+++ b/engines/grim/lua/ldo.cpp
@@ -233,8 +233,18 @@ int32 luaD_call(StkId base, int32 nResults) {
 			firstResult = callC(fvalue(funcObj), base);
 		} else {
 			TObject *im = luaT_getimbyObj(funcObj, IM_FUNCTION);
-			if (ttype(im) == LUA_T_NIL)
-				lua_error("call expression not a function");
+			if (ttype(im) == LUA_T_NIL) {
+				// NOTE: Originally this throwed the lua_error. Anyway it is commented here because
+				// when in year 4 bi.exit() calls bi.book.act:free(). But bi.book.act is nil,
+				// hence it enters this branch and the error blocks the game.
+				// Now we try instead to survive and go on with the function.
+				lua_Task *t = lua_state->task;
+				lua_state->task = t->next;
+				lua_state->prevTask = tmpTask;
+				luaM_free(t);
+				warning("Lua: call expression not a function");
+				return 1;
+			}
 			luaD_callTM(im, (lua_state->stack.top - lua_state->stack.stack) - (base - 1), nResults);
 			continue;
 		}




More information about the Scummvm-git-logs mailing list