Skip to content

Commit f63c307

Browse files
committed
fix crash when doing simulation = nil in the console
1 parent 6930d83 commit f63c307

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/lua/LuaScriptInterface.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3313,7 +3313,11 @@ bool LuaScriptInterface::OnMouseTick()
33133313
void LuaScriptInterface::OnTick()
33143314
{
33153315
lua_getglobal(l, "simulation");
3316-
lua_pushinteger(l, luacon_sim->NUM_PARTS); lua_setfield(l, -2, "NUM_PARTS");
3316+
if (lua_istable(l, -1))
3317+
{
3318+
lua_pushinteger(l, luacon_sim->NUM_PARTS);
3319+
lua_setfield(l, -2, "NUM_PARTS");
3320+
}
33173321
lua_pop(l, 1);
33183322
ui::Engine::Ref().LastTick(Platform::GetTime());
33193323
luacon_step(luacon_mousex, luacon_mousey);

0 commit comments

Comments
 (0)