mirror of
https://github.com/ciribob/DCS-CTLD.git
synced 2026-08-18 13:15:56 +00:00
hardened the code to avoid a nil value in ctld.setGrpROE
This commit is contained in:
@@ -6770,9 +6770,7 @@ function ctld.setGrpROE(_grp, _ROE)
|
|||||||
_ROE = AI.Option.Ground.val.ROE.OPEN_FIRE
|
_ROE = AI.Option.Ground.val.ROE.OPEN_FIRE
|
||||||
end
|
end
|
||||||
|
|
||||||
_grp = ctld.getAliveGroup(_grp)
|
if _grp and _grp:isExist() == true and #_grp:getUnits() > 0 then -- check if the group truly exists
|
||||||
|
|
||||||
if _grp ~= nil then
|
|
||||||
local _controller = _grp:getController();
|
local _controller = _grp:getController();
|
||||||
Controller.setOption(_controller, AI.Option.Ground.id.ALARM_STATE, AI.Option.Ground.val.ALARM_STATE.AUTO)
|
Controller.setOption(_controller, AI.Option.Ground.id.ALARM_STATE, AI.Option.Ground.val.ALARM_STATE.AUTO)
|
||||||
Controller.setOption(_controller, AI.Option.Ground.id.ROE, _ROE)
|
Controller.setOption(_controller, AI.Option.Ground.id.ROE, _ROE)
|
||||||
|
|||||||
Reference in New Issue
Block a user