Check if unit exists before calling UnitIsUnit

This commit is contained in:
Tercio Jose
2019-10-19 21:00:47 -03:00
parent f01394be98
commit 7a301fbca8
2 changed files with 5 additions and 6 deletions
+2 -2
View File
@@ -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)
+3 -4
View File
@@ -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