I had an addon creating a SoulShard bar fro Afflic locks pre-7.0
I have updated it so that is shows and (seems) to work without issue for all Lock specs, however.. I get this error:
Code:
Message: ...terface\AddOns\oUF_Diablo\modules\oUF_SoulShards.lua:49: attempt to index local 'orb' (a nil value)
Time: 07/29/16 14:12:44
Count: 3
Stack: ...terface\AddOns\oUF_Diablo\modules\oUF_SoulShards.lua:49: in function <...terface\AddOns\oUF_Diablo\modules\oUF_SoulShards.lua:11>
(tail call): ?
(tail call): ?
...terface\AddOns\oUF_Diablo\modules\oUF_SoulShards.lua:67: in function <...terface\AddOns\oUF_Diablo\modules\oUF_SoulShards.lua:57>
(tail call): ?
The function in which it refers to is:
Lua Code:
local Update = function(self, event, unit, powerType)
local bar = self.SoulShardPowerBar
local cur = UnitPower(unit, SPELL_POWER_SOUL_SHARDS)
local max = UnitPowerMax(unit, SPELL_POWER_SOUL_SHARDS)
--[[ --do not hide the bar when the value is empty, keep it visible
if cur < 1 then
if bar:IsShown() then bar:Hide() end
return
else
if not bar:IsShown() then bar:Show() end
end
]]
--adjust the width of the soulshard power frame
local w = 64*(max+1)
bar:SetWidth(w)
for i = 1, bar.maxOrbs do
local orb = self.SoulShards[i]
if i > max then
if orb:IsShown() then orb:Hide() end
else
if not orb:IsShown() then orb:Show() end
end
end
for i = 1, max do
local orb = self.SoulShards[i]
local full = cur/max
if(i <= cur) then
if full == 1 then
orb.fill:SetVertexColor(1,0,0)
orb.glow:SetVertexColor(1,0,0)
else
orb.fill:SetVertexColor(bar.color.r,bar.color.g,bar.color.b)
orb.glow:SetVertexColor(bar.color.r,bar.color.g,bar.color.b)
end
orb.fill:Show()
orb.glow:Show()
orb.highlight:Show()
else
orb.fill:Hide()
orb.glow:Hide()
orb.highlight:Hide()
end
end
Line 49 being the "orb.fill:Hide()" line in the else condition at the end. Commenting out that leads me to line 50, then 51.
Commenting all 3 of those out removes the error, however it breaks the addon.
With the lines commented out, the soul shards are added to the bar as they are built, but are not removed when consumed.
Not commented out, the soul shards are removed from the bar as expected, but I am spammed with this error countless times while in combat.
Since it's returning with an error, it is also affecting other aspects of the UI addon I have built this into, so leaving the lines and ignoring the errors is not really an option.