Make sure the arena unit exists before continuing

This commit is contained in:
Tercio Jose
2021-04-08 11:00:16 -03:00
parent 5a1cef5001
commit 2d243d13b5
3 changed files with 72 additions and 14 deletions
+4 -4
View File
@@ -927,21 +927,21 @@
function Details:GetPlayersInArena()
local aliados = GetNumGroupMembers() -- LE_PARTY_CATEGORY_HOME
for i = 1, aliados-1 do
local role = UnitGroupRolesAssigned ("party" .. i)
if (role ~= "NONE") then
local role = UnitGroupRolesAssigned and UnitGroupRolesAssigned("party" .. i) or "DAMAGER"
if (role ~= "NONE" and UnitExists("party" .. i)) then
local name = GetUnitName ("party" .. i, true)
Details.arena_table [name] = {role = role}
end
end
local role = UnitGroupRolesAssigned ("player")
local role = UnitGroupRolesAssigned and UnitGroupRolesAssigned("player") or "DAMAGER"
if (role ~= "NONE") then
local name = GetUnitName ("player", true)
Details.arena_table [name] = {role = role}
end
--enemies
local enemiesAmount = GetNumArenaOpponentSpecs()
local enemiesAmount = GetNumArenaOpponentSpecs and GetNumArenaOpponentSpecs() or 5
table.wipe(_detalhes.arena_enemies)
for i = 1, enemiesAmount do