WeakAuras incorrectly using color api
Jodsderechte opened this issue ยท 2 comments
Is there an existing issue for this?
- I have searched the existing open and closed issues.
Description
No idea how or why this happened i was just randomly editing a WeakAuras size in the display tab (i think)
WeakAuras Version
5.15.4
World of Warcraft Flavor
Retail (Default)
World of Warcraft Region
EU
Tested with only WeakAuras
I got this issue with only WeakAuras enabled
Lua Error
1x Blizzard_SharedXML/Color.lua:67: bad argument #2 to 'format' (string expected, got nil)
[string "=[C]"]: in function `format'
[string "@Blizzard_SharedXML/Color.lua"]:67: in function <Blizzard_SharedXML/Color.lua:66>
[string "=(tail call)"]: ?
[string "=(tail call)"]: ?
[string "@WeakAuras/WeakAuras.lua"]:5060: in function <WeakAuras/WeakAuras.lua:5036>
[string "@WeakAuras/WeakAuras.lua"]:5126: in function `ReplacePlaceHolders'
[string "@WeakAuras/SubRegionTypes/SubText.lua"]:317: in function `?'
[string "@WeakAuras/SubscribableObject.lua"]:94: in function `Notify'
[string "@WeakAuras/WeakAuras.lua"]:4609: in function <WeakAuras/WeakAuras.lua:4604>
[string "@WeakAuras/WeakAuras.lua"]:4696: in function <WeakAuras/WeakAuras.lua:4662>
[string "@WeakAuras/WeakAuras.lua"]:4827: in function `UpdatedTriggerState'
[string "@WeakAuras/GenericTrigger.lua"]:905: in function `ScanEventsInternal'
[string "@WeakAuras/GenericTrigger.lua"]:842: in function `ScanEvents'
[string "@WeakAuras/GenericTrigger.lua"]:1854: in function <WeakAuras/GenericTrigger.lua:1852>
Reproduction Steps
I wouldn't know but here are my saved variables
WeakAuras.zip
Last Good Version
No idea
Screenshots
No response
Export String
No response
Bisector Report
No response
The function at Color.lua:67 is WrapTextInColorCode, and with the error message " bad argument #2 to 'format'", it seems that the text is nil.
The only place where WrapTextInColorCode is called is from the "unit/guid" formatters when they are formatting a unit in the class color.
Now, looking at the code I don't see how this can be, for the guid formatter, we only call the colorFunc if we have a name at all. So unless LibCustomName can map a "not nil name" to a nil name, I don't see any place where that could go wrong for guids.
For unit formatting, we do retrieve the "UnitGUID" and "UnitClass" of the unit, if either of these cannot be determined, we don't call WrapTextInColorCode. Now, iirc correctly UnitName only returns nil if the unit is invalid. If the unit is valid but the name is not yet known, it returns "Unknown". Thus as far as I know this can again only happen if CustomNames returned a nil value from mapping.
I suggest you try to reproduce it with that information and then verify that it isn't a LibCustomNames issue. If you can reliable reproduce it, see in which circumstances you return a nil value, and we can then figure out whether the WOW api would behave similarly and thus WA should handle it.