diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index 1c38db672..0109a9719 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -1058,9 +1058,12 @@ function GROUP:GetTypeName() local DCSGroup = self:GetDCSObject() if DCSGroup then - local GroupTypeName = DCSGroup:getUnit(1):getTypeName() - --self:T3( GroupTypeName ) - return( GroupTypeName ) + local unit = DCSGroup:getUnit(1) + if unit then + local GroupTypeName = unit:getTypeName() + --self:T3( GroupTypeName ) + return( GroupTypeName ) + end end return nil @@ -1075,9 +1078,12 @@ function GROUP:GetNatoReportingName() local DCSGroup = self:GetDCSObject() if DCSGroup then - local GroupTypeName = DCSGroup:getUnit(1):getTypeName() - --self:T3( GroupTypeName ) - return UTILS.GetReportingName(GroupTypeName) + local unit = DCSGroup:getUnit(1) + if unit then + local GroupTypeName = unit:getTypeName() + --self:T3( GroupTypeName ) + return UTILS.GetReportingName(GroupTypeName) + end end return "Bogey" @@ -1093,9 +1099,12 @@ function GROUP:GetPlayerName() local DCSGroup = self:GetDCSObject() if DCSGroup then - local PlayerName = DCSGroup:getUnit(1):getPlayerName() - --self:T3( PlayerName ) - return( PlayerName ) + local unit = DCSGroup:getUnit(1) + if unit then + local PlayerName = unit:getPlayerName() + --self:T3( PlayerName ) + return( PlayerName ) + end end return nil @@ -1111,9 +1120,12 @@ function GROUP:GetCallsign() local DCSGroup = self:GetDCSObject() if DCSGroup then - local GroupCallSign = DCSGroup:getUnit(1):getCallsign() - --self:T3( GroupCallSign ) - return GroupCallSign + local unit = DCSGroup:getUnit(1) + if unit then + local GroupCallSign = unit:getCallsign() + --self:T3( GroupCallSign ) + return GroupCallSign + end end BASE:E( { "Cannot GetCallsign", Positionable = self, Alive = self:IsAlive() } )