diff options
author | Mattes D <github@xoft.cz> | 2017-06-09 12:16:31 +0200 |
---|---|---|
committer | Lukas Pioch <lukas@zgow.de> | 2017-06-09 12:16:31 +0200 |
commit | 3c4e443ddc211b4ecdd2b990a3fa9b12b46efaf6 (patch) | |
tree | 51b2547f57ffda8523432cacf10788cedbef352f /src/Bindings/LuaState.cpp | |
parent | Fixes problems with windows: (diff) | |
download | cuberite-3c4e443ddc211b4ecdd2b990a3fa9b12b46efaf6.tar cuberite-3c4e443ddc211b4ecdd2b990a3fa9b12b46efaf6.tar.gz cuberite-3c4e443ddc211b4ecdd2b990a3fa9b12b46efaf6.tar.bz2 cuberite-3c4e443ddc211b4ecdd2b990a3fa9b12b46efaf6.tar.lz cuberite-3c4e443ddc211b4ecdd2b990a3fa9b12b46efaf6.tar.xz cuberite-3c4e443ddc211b4ecdd2b990a3fa9b12b46efaf6.tar.zst cuberite-3c4e443ddc211b4ecdd2b990a3fa9b12b46efaf6.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/LuaState.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index ca0a258d9..947e337fc 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -1454,8 +1454,12 @@ bool cLuaState::CallFunction(int a_NumResults) LOGWARNING("Error in %s calling function %s()", m_SubsystemName.c_str(), CurrentFunctionName.c_str()); // Remove the error handler and error message from the stack: - ASSERT(lua_gettop(m_LuaState) == 2); - lua_pop(m_LuaState, 2); + auto top = lua_gettop(m_LuaState); + if (top < 2) + { + LogStackValues(Printf("The Lua stack is in an unexpected state, expected at least two values there, but got %d", top).c_str()); + } + lua_pop(m_LuaState, std::min(2, top)); return false; } |