Skip to content

Commit

Permalink
Check if unit exists before calling UnitIsUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Oct 20, 2019
1 parent f01394b commit 7a301fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 3 additions & 4 deletions classes/classe_others.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7a301fb

Please sign in to comment.