1
0

Improved error resistance in cPluginManager:CallPlugin().

Fixed: If the call failed, all the next plugin calls would fail as well.
This commit is contained in:
madmaxoft 2014-02-04 09:18:32 +01:00
parent 1bd939c4d4
commit aa19f4fd04

View File

@ -1066,6 +1066,8 @@ int cLuaState::CallFunctionWithForeignParams(
{ {
// Something went wrong, fix the stack and exit // Something went wrong, fix the stack and exit
lua_pop(m_LuaState, 2); lua_pop(m_LuaState, 2);
m_NumCurrentFunctionArgs = -1;
m_CurrentFunctionName.clear();
return -1; return -1;
} }
@ -1081,11 +1083,17 @@ int cLuaState::CallFunctionWithForeignParams(
{ {
lua_pop(m_LuaState, CurTop - OldTop); lua_pop(m_LuaState, CurTop - OldTop);
} }
// Reset the internal checking mechanisms:
m_NumCurrentFunctionArgs = -1;
m_CurrentFunctionName.clear();
return -1; return -1;
} }
// Reset the internal checking mechanisms: // Reset the internal checking mechanisms:
m_NumCurrentFunctionArgs = -1; m_NumCurrentFunctionArgs = -1;
m_CurrentFunctionName.clear();
// Remove the error handler from the stack: // Remove the error handler from the stack:
lua_remove(m_LuaState, OldTop + 1); lua_remove(m_LuaState, OldTop + 1);