Fixed nil value problem in friendlies search

This commit is contained in:
FlightControl_Master 2017-08-30 20:11:31 +02:00
parent 05d9faedee
commit bfd0c19109

View File

@ -1281,10 +1281,11 @@ do -- DETECTION_BASE
--- @param Wrapper.Unit#UNIT PlayerUnit --- @param Wrapper.Unit#UNIT PlayerUnit
function( PlayerUnitName ) function( PlayerUnitName )
local PlayerUnit = UNIT:FindByName( PlayerUnitName ) local PlayerUnit = UNIT:FindByName( PlayerUnitName )
local PlayerUnitCategory = PlayerUnit:GetDesc().category
if PlayerUnit and PlayerUnit:IsInZone(DetectionZone) then if PlayerUnit and PlayerUnit:IsInZone(DetectionZone) then
local PlayerUnitCategory = PlayerUnit:GetDesc().category
if ( not self.FriendliesCategory ) or ( self.FriendliesCategory and ( self.FriendliesCategory == PlayerUnitCategory ) ) then if ( not self.FriendliesCategory ) or ( self.FriendliesCategory and ( self.FriendliesCategory == PlayerUnitCategory ) ) then
DetectedItem.FriendliesNearBy = DetectedItem.FriendliesNearBy or {} DetectedItem.FriendliesNearBy = DetectedItem.FriendliesNearBy or {}