From 7a301fbca818ef955cc9e4c66a9191d342166344 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sat, 19 Oct 2019 21:00:47 -0300 Subject: [PATCH] Check if unit exists before calling UnitIsUnit --- boot.lua | 4 ++-- classes/classe_others.lua | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/boot.lua b/boot.lua index 2fb18c485..529a6e2f6 100644 --- a/boot.lua +++ b/boot.lua @@ -4,8 +4,8 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - _detalhes.build_counter = 7222 - _detalhes.alpha_build_counter = 7222 --if this is higher than the regular counter, use it instead + _detalhes.build_counter = 7223 + _detalhes.alpha_build_counter = 7223 --if this is higher than the regular counter, use it instead _detalhes.game_version = "v8.2.5" _detalhes.userversion = "v8.2.5." .. _detalhes.build_counter _detalhes.realversion = 140 --core version, this is used to check API version for scripts and plugins (see alias below) diff --git a/classes/classe_others.lua b/classes/classe_others.lua index 4067a0259..871c38bb1 100644 --- a/classes/classe_others.lua +++ b/classes/classe_others.lua @@ -1413,8 +1413,7 @@ function _detalhes:CatchRaidBuffUptime (in_or_out) for buffIndex = 1, 41 do local name, _, _, _, _, _, unitCaster, _, _, spellid = _UnitAura (RaidIndex, buffIndex, nil, "HELPFUL") - if (name and UnitIsUnit (unitCaster, RaidIndex)) then - + if (name and unitCaster and UnitExists (RaidIndex) and UnitIsUnit (unitCaster, RaidIndex)) then _detalhes.parser:add_buff_uptime (nil, cacheGetTime, playerGUID, playerName, 0x00000514, playerGUID, playerName, 0x00000514, 0x0, spellid, name, in_or_out) if (in_or_out == "BUFF_UPTIME_IN") then @@ -1457,7 +1456,7 @@ function _detalhes:CatchRaidBuffUptime (in_or_out) for groupIndex = 1, _GetNumGroupMembers() - 1 do for buffIndex = 1, 41 do local name, _, _, _, _, _, unitCaster, _, _, spellid = _UnitAura ("party"..groupIndex, buffIndex, nil, "HELPFUL") - if (name and UnitIsUnit (unitCaster, "party" .. groupIndex)) then + if (name and unitCaster and UnitExists ("party" .. groupIndex) and UnitIsUnit (unitCaster, "party" .. groupIndex)) then local playerName, realmName = _UnitName ("party"..groupIndex) local playerGUID = _UnitGUID ("party"..groupIndex) @@ -1485,7 +1484,7 @@ function _detalhes:CatchRaidBuffUptime (in_or_out) --player it self for buffIndex = 1, 41 do local name, _, _, _, _, _, unitCaster, _, _, spellid = _UnitAura ("player", buffIndex, nil, "HELPFUL") - if (name and UnitIsUnit (unitCaster, "player")) then + if (name and unitCaster and UnitIsUnit (unitCaster, "player")) then local playerName = _UnitName ("player") local playerGUID = _UnitGUID ("player") if (playerGUID) then