oUF-wow / oUF

WoW AddOn - Unit frame framework.
MIT License
221 stars 58 forks source link

Using tags.Methods["threatcolor"](unit) breaks frequently on 10.2.6 #673

Closed arnvid closed 5 months ago

arnvid commented 5 months ago

Describe the bug Whenever you target a unit it throws an error. And it blocks oUF frames from updating properly.,

How to reproduce Any time I call the function with tags.Methods"threatcolor" it throws the following error. But if you call it with tags.Methods["threatcolor"]("player", unit) it works.

Function in Tags:

['threatcolor'] = [[function(u)
    return Hex(GetThreatStatusColor(UnitThreatSituation(u)))
end]],

By checking - UnitThreatSituation(unit) - it always returns nil - and if you call tags.Methods["threatcolor"] with unit, it will always try to call GetThreatStatusColor with nill which does fail.

My current workaround is:

local status =  UnitThreatSituation("player", unit)
local color = nil
if (status ~= nil) and (_G.GetNumGroupMembers() > 0 or UnitExists("pet")) then
    color = tags.Methods["threatcolor"]("player", unit)
end

What did you expect? As this code has not changed in RealUI for several years, and not in oUF either - I suspect something changed in Blizzard backend?

Error report x4 [string "return function(u)..."]:2: Usage: local r, g, b = GetThreatStatusColor(gameErrorIndex) Stack: [string "=[C]"]: in function 'GetThreatStatusColor' [string "return function(u) return Hex(GetThreatStatusColor(UnitThreatSituation(u))) end"]:2: in function 'threatcolor' [string "@Interface/AddOns/RealUI_Core-2.3.11/HuD/UnitFrames/Tags.lua"]:210: in function 'f' [string "@Interface/AddOns/oUF/elements/tags.lua"]:792: in function 'UpdateTag' [string "@Interface/AddOns/oUF/elements/tags.lua"]:668: in function 'func' [string "@Interface/AddOns/oUF/ouf.lua"]:200: in function <Interface/AddOns/oUF/ouf.lua:183>

[string "@Interface/AddOns/oUF/ouf.lua"]:218: in function <Interface/AddOns/oUF/ouf.lua:217> [string "=[C]"]: in function 'Show' [string "@Interface/FrameXML/SecureStateDriver.lua"]:83: in function <Interface/FrameXML/SecureStateDriver.lua:73> [string "@Interface/FrameXML/SecureStateDriver.lua"]:137: in function <Interface/FrameXML/SecureStateDriver.lua:119> Time: 2024/03/20 23:58:46 Index: 4/4 Locals: (*temporary) = nil

Screenshots

ls- commented 5 months ago

Hmmm, the in fact did change how GetThreatStatusColor works.

Thanks for the report. Idk why I manually closed it, but oh well...