Only show debug error once. Suppress defender=0 for now.

Sasky [06-06-14 - 15:02]
Only show debug error once. Suppress defender=0 for now.
Filename
CyrHUD.txt
classes/Battle.lua
diff --git a/CyrHUD.txt b/CyrHUD.txt
index 95cced6..56ccf1e 100644
--- a/CyrHUD.txt
+++ b/CyrHUD.txt
@@ -1,6 +1,6 @@
 ## APIVersion: 100004
 ## Title: CyrHUD
-## Version: 0.9.2
+## Version: 0.9.3
 ## Author: Sasky

 classes/Battle.lua
diff --git a/classes/Battle.lua b/classes/Battle.lua
index b292447..6c43025 100644
--- a/classes/Battle.lua
+++ b/classes/Battle.lua
@@ -12,6 +12,13 @@ end
 -- Setup class
 CyrHUD.Battle = {}
 CyrHUD.Battle.__index = CyrHUD.Battle
+CyrHUD.errors = ""
+CyrHUD.error = function(val)
+    if not CyrHUD.errors[val] then
+        CyrHUD.errors[val] = 1
+        d("|cFF0000ERROR (CyrHUD): " .. val .. " / Please file this bug info at esoui.com")
+    end
+end
 setmetatable(CyrHUD.Battle, {
     __call = function (cls, ...)
         return cls.new(...)
@@ -159,9 +166,13 @@ end
     @see CyrHUD.info
 ]]
 function CyrHUD.Battle:getIcon()
+    if self.defender == 0 then
+        return CyrHUD.info.noIcon
+    end
+
     --Debug code
     if CyrHUD.info[self.defender] == nil or CyrHUD.info[self.defender][self.keepType] == nil then
-        d("|cFF0000ERROR: CyrHUD. Bad icon lookup. Defender: " .. self.defender .. " / KeepType: " .. self.keepType)
+        CyrHUD.error("Bad icon lookup. Defender: " .. self.defender .. " / KeepType: " .. self.keepType)
         d("|cFF0000Please file this bug info at esoui.com")
         return CyrHUD.info.noIcon
     end