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,9 +316,12 @@ function GROUP:GetPositionVec3() -- Overridden from POSITIONABLE:GetPositionVec3
|
|||||||
local DCSPositionable = self:GetDCSObject()
|
local DCSPositionable = self:GetDCSObject()
|
||||||
|
|
||||||
if DCSPositionable then
|
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 )
|
self:T3( PositionablePosition )
|
||||||
return PositionablePosition
|
return PositionablePosition
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -366,9 +369,11 @@ function GROUP:IsActive()
|
|||||||
local DCSGroup = self:GetDCSObject() -- DCS#Group
|
local DCSGroup = self:GetDCSObject() -- DCS#Group
|
||||||
|
|
||||||
if DCSGroup then
|
if DCSGroup then
|
||||||
|
local unit = DCSGroup:getUnit(1)
|
||||||
local GroupIsActive = DCSGroup:getUnit(1):isActive()
|
if unit then
|
||||||
|
local GroupIsActive = unit:isActive()
|
||||||
return GroupIsActive
|
return GroupIsActive
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user