Fixed addon trying to analyze units with no valid GUID.
Adam Hellberg [09-28-13 - 18:44]
Fixed addon trying to analyze units with no valid GUID.
diff --git a/KillTrack.lua b/KillTrack.lua
index 447b9c2..3625077 100644
--- a/KillTrack.lua
+++ b/KillTrack.lua
@@ -214,6 +214,7 @@ end
function KT.Events.UPDATE_MOUSEOVER_UNIT(self, ...)
if UnitIsPlayer("mouseover") then return end
local id = KTT:GUIDToID(UnitGUID("mouseover"))
+ if not id then return end
if UnitCanAttack("player", "mouseover") then
local gKills, cKills = self:GetKills(id)
GameTooltip:AddLine(("Killed %d (%d) times."):format(cKills, gKills), 1, 1, 1)
diff --git a/Tools.lua b/Tools.lua
index ac517f2..8f48011 100644
--- a/Tools.lua
+++ b/Tools.lua
@@ -84,5 +84,6 @@ end
-----------------
function KTT:GUIDToID(guid)
+ if not guid then return nil end
return tonumber(guid:sub(6, 10), 16)
end