Merge pull request #519 from FlightControl-Master/517-Fix-designate-failing-on-empty-set

Fixed #517 - When detected set is empty, script fails when lasing is activated.
This commit is contained in:
Sven Van de Velde 2017-05-15 12:40:58 +02:00 committed by GitHub
commit 4d52c0ce3e

View File

@ -1611,6 +1611,7 @@ function SET_UNIT:ForEachUnitPerThreatLevel( FromThreatLevel, ToThreatLevel, Ite
local ThreatLevelSet = {} local ThreatLevelSet = {}
if self:Count() ~= 0 then
for UnitName, UnitObject in pairs( self.Set ) do for UnitName, UnitObject in pairs( self.Set ) do
local Unit = UnitObject -- Wrapper.Unit#UNIT local Unit = UnitObject -- Wrapper.Unit#UNIT
@ -1630,10 +1631,13 @@ function SET_UNIT:ForEachUnitPerThreatLevel( FromThreatLevel, ToThreatLevel, Ite
self:ForEach( IteratorFunction, arg, ThreatLevelItem.Set ) self:ForEach( IteratorFunction, arg, ThreatLevelItem.Set )
end end
end end
end
return self return self
end end
--- Iterate the SET_UNIT and call an iterator function for each **alive** UNIT presence completely in a @{Zone}, providing the UNIT and optional parameters to the called function. --- Iterate the SET_UNIT and call an iterator function for each **alive** UNIT presence completely in a @{Zone}, providing the UNIT and optional parameters to the called function.
-- @param #SET_UNIT self -- @param #SET_UNIT self
-- @param Core.Zone#ZONE ZoneObject The Zone to be tested for. -- @param Core.Zone#ZONE ZoneObject The Zone to be tested for.