Skip to content

Commit

Permalink
fix crash when doing simulation = nil in the console
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Dec 11, 2015
1 parent 6930d83 commit f63c307
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lua/LuaScriptInterface.cpp
Expand Up @@ -3313,7 +3313,11 @@ bool LuaScriptInterface::OnMouseTick()
void LuaScriptInterface::OnTick()
{
lua_getglobal(l, "simulation");
lua_pushinteger(l, luacon_sim->NUM_PARTS); lua_setfield(l, -2, "NUM_PARTS");
if (lua_istable(l, -1))
{
lua_pushinteger(l, luacon_sim->NUM_PARTS);
lua_setfield(l, -2, "NUM_PARTS");
}
lua_pop(l, 1);
ui::Engine::Ref().LastTick(Platform::GetTime());
luacon_step(luacon_mousex, luacon_mousey);
Expand Down

0 comments on commit f63c307

Please sign in to comment.