mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Added some protection against unexpectedly-nil values.
This commit is contained in:
parent
4ef827836c
commit
7cf73af707
@ -316,10 +316,13 @@ function GROUP:GetPositionVec3() -- Overridden from POSITIONABLE:GetPositionVec3
|
||||
local DCSPositionable = self:GetDCSObject()
|
||||
|
||||
if DCSPositionable then
|
||||
local PositionablePosition = DCSPositionable:getUnits()[1]:getPosition().p
|
||||
local unit = DCSPositionable:getUnits()[1]
|
||||
if unit then
|
||||
local PositionablePosition = unit:getPosition().p
|
||||
self:T3( PositionablePosition )
|
||||
return PositionablePosition
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
@ -366,10 +369,12 @@ function GROUP:IsActive()
|
||||
local DCSGroup = self:GetDCSObject() -- DCS#Group
|
||||
|
||||
if DCSGroup then
|
||||
|
||||
local GroupIsActive = DCSGroup:getUnit(1):isActive()
|
||||
local unit = DCSGroup:getUnit(1)
|
||||
if unit then
|
||||
local GroupIsActive = unit:isActive()
|
||||
return GroupIsActive
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user