aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2019-06-22 23:52:34 +0200
committerEugene Sandulenko2019-09-03 17:16:56 +0200
commit86cc1df32d616c074b793efdc8dfbf851cb5f70b (patch)
tree33467003a561104af24129eee53629176da9b5f6
parenta3b650be3644cbc4c4e2205be4b9d8e719e8d3e1 (diff)
downloadscummvm-rg350-86cc1df32d616c074b793efdc8dfbf851cb5f70b.tar.gz
scummvm-rg350-86cc1df32d616c074b793efdc8dfbf851cb5f70b.tar.bz2
scummvm-rg350-86cc1df32d616c074b793efdc8dfbf851cb5f70b.zip
HDB: Fix crash when executing Lua with debug options
-rw-r--r--engines/hdb/lua-script.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp
index 9691763afa..edd47bc2e5 100644
--- a/engines/hdb/lua-script.cpp
+++ b/engines/hdb/lua-script.cpp
@@ -860,12 +860,12 @@ bool LuaScript::initScript(Common::SeekableReadStream *stream, const char *scrip
return false;
}
+ lua_getglobal(_state, "level_init");
+
// Error handling function to be executed after the function is put on the stack
lua_rawgeti(_state, LUA_REGISTRYINDEX, _pcallErrorhandlerRegistryIndex);
lua_insert(_state, -2);
- lua_getglobal(_state, "level_init");
-
if (lua_pcall(_state, 0, 0, -2)) {
error("An error occured while executing \"%s\": %s.", "level_init", lua_tostring(_state, -1));
lua_pop(_state, -1);