Fix off-by-one issue in sim.parts, fixes #678
This commit is contained in:
parent
66ef37e778
commit
28d5345bf9
@ -1893,10 +1893,8 @@ int PartsClosure(lua_State * l)
|
||||
int i = lua_tointeger(l, lua_upvalueindex(1));
|
||||
do
|
||||
{
|
||||
if(i>=NPART)
|
||||
if (++i >= NPART)
|
||||
return 0;
|
||||
else
|
||||
i++;
|
||||
} while (!luacon_sim->parts[i].type);
|
||||
lua_pushnumber(l, i);
|
||||
lua_replace(l, lua_upvalueindex(1));
|
||||
|
Loading…
Reference in New Issue
Block a user