[FIXED] dcsgroup:getUnit(1) nil pointer

This commit is contained in:
Shafik
2025-11-05 12:35:55 +02:00
parent 2f39e38264
commit 832941494b
+24 -12
View File
@@ -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() } )