fix lua crashing after an lua error

This fixes 797613f760

which changed the luaW_pcall code from.

 if(lua_pcall(..)) {
   ...
   lua_pop(L, 2);
   return;
 }
 lua_remove(L, error_handler_index);

to

 int r = lua_pcall(..);
 lua_remove(L, error_handler_index);
 if(r) {
   ...
   lua_pop(L, 2);
   return;
 }

so that three values were removed from the stack in case of an error which caused random segfaults later.
This commit is contained in:
gfgtdf 2016-10-22 15:28:03 +02:00 committed by GitHub
parent 06570d093e
commit 806a388b9d

View file

@ -983,7 +983,7 @@ bool luaW_pcall(lua_State *L, int nArgs, int nRets, bool allow_wml_error)
} else {
chat_message("Lua caught unknown exception", "");
}
lua_pop(L, 2);
lua_pop(L, 1);
return false;
}