mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-07-31 21:50:18 +02:00
Fix crash when a Lua tool Perform callback throws an error
Broken since 00ec4e0754
, when the Perform callback was added. It's a bad idea to pop return values that never got pushed because the function that was supposed to push them threw an error.
This commit is contained in:
@@ -91,12 +91,15 @@ static int luaPerformWrapper(SimTool *tool, Simulation *sim, Particle *cpart, in
|
||||
lsi->Log(CommandInterface::LogError, "In perform func: " + LuaGetError());
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lua_isboolean(L, -1))
|
||||
{
|
||||
ok = lua_toboolean(L, -1);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user