Skip to content

Commit

Permalink
Merge pull request #4910 from myk002/myk_unitsinbox
Browse files Browse the repository at this point in the history
fix error when calling getUnitsInBox without optional param
  • Loading branch information
myk002 authored Sep 4, 2024
2 parents 5ccdc6a + 7b125ea commit dec0c27
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/LuaApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2181,7 +2181,7 @@ static int units_getUnitsInBox(lua_State *state) {
int z2 = luaL_checkint(state, 6);

bool ok = false;
if (lua_isnil(state, 7)) // Default filter
if (lua_gettop(state) < 7 || lua_isnil(state, 7)) // Default filter
ok = Units::getUnitsInBox(units, x1, y1, z1, x2, y2, z2);
else {
luaL_checktype(state, 7, LUA_TFUNCTION);
Expand Down

0 comments on commit dec0c27

Please sign in to comment.