Skip to content

Commit dec0c27

Browse files
authored
Merge pull request DFHack#4910 from myk002/myk_unitsinbox
fix error when calling getUnitsInBox without optional param
2 parents 5ccdc6a + 7b125ea commit dec0c27

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/LuaApi.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2181,7 +2181,7 @@ static int units_getUnitsInBox(lua_State *state) {
21812181
int z2 = luaL_checkint(state, 6);
21822182

21832183
bool ok = false;
2184-
if (lua_isnil(state, 7)) // Default filter
2184+
if (lua_gettop(state) < 7 || lua_isnil(state, 7)) // Default filter
21852185
ok = Units::getUnitsInBox(units, x1, y1, z1, x2, y2, z2);
21862186
else {
21872187
luaL_checktype(state, 7, LUA_TFUNCTION);

0 commit comments

Comments
 (0)