Fix off-by-one issue in sim.parts, fixes #678
This commit is contained in:
parent
66ef37e778
commit
28d5345bf9
@ -1893,11 +1893,9 @@ 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);
|
||||
} while (!luacon_sim->parts[i].type);
|
||||
lua_pushnumber(l, i);
|
||||
lua_replace(l, lua_upvalueindex(1));
|
||||
lua_pushnumber(l, i);
|
||||
|
Loading…
Reference in New Issue
Block a user