Buffomat Classic

Buffomat Classic

331k Downloads

Wrong variable used in GroupBuffTarget.lua

Anonomit opened this issue ยท 3 comments

commented

Version: 2021.10.3-5077c00b

Line 37 src/classes/GroupBuffTarget.lua:
local memberDistance = BOM.Tool.UnitDistanceSquared(name)
should be:
local memberDistance = BOM.Tool.UnitDistanceSquared(rName)

Unit names can be used in place of unitIDs sometimes (like when the unit is a party member). This is why the function works most of the time. It causes errors though, because there are instances when the unit name is not an acceptable unitID.

The function is used with a correct variable a few lines later. Line 49 src/classes/GroupBuffTarget.lua:
local memberDistance = BOM.Tool.UnitDistanceSquared(pName)
The variable pName is used, which is a unitID like rName.

Here is my most recent error. I haven't had another one since making this change to my own version.

19x BuffomatClassicTBC\src/Toolbox.lua:281: Usage: UnitIsUnit("unit", "otherUnit")
[string "=[C]"]: in function UnitIsUnit' [string "@BuffomatClassicTBC\src/Toolbox.lua"]:281: in function UnitDistanceSquared'
[string "@BuffomatClassicTBC\src/classes/GroupBuffTarget.lua"]:37: in function GetDistance' [string "@BuffomatClassicTBC\src/classes/Task.lua"]:36: in function new'
[string "@BuffomatClassicTBC\src/classes/TaskList.lua"]:53: in function AddWithPrefix' [string "@BuffomatClassicTBC\src/TaskScan.lua"]:1155: in function <BuffomatClassicTBC\src/TaskScan.lua:1111> [string "@BuffomatClassicTBC\src/TaskScan.lua"]:1824: in function <BuffomatClassicTBC\src/TaskScan.lua:1737> [string "@BuffomatClassicTBC\src/TaskScan.lua"]:1847: in function <BuffomatClassicTBC\src/TaskScan.lua:1836> [string "@BuffomatClassicTBC\src/TaskScan.lua"]:1910: in function <BuffomatClassicTBC\src/TaskScan.lua:1880> [string "@BuffomatClassicTBC\src/TaskScan.lua"]:2042: in function <BuffomatClassicTBC\src/TaskScan.lua:2004> [string "@BuffomatClassicTBC\src/TaskScan.lua"]:2050: in function UpdateScan'
[string "@BuffomatClassicTBC\src/Bom.lua"]:712: in function <BuffomatClassicTBC\src/Bom.lua:710>
...
[string "=[C]"]: ?
[string "=[C]"]: ?
[string "=[C]"]: in function UseAction' [string "@FrameXML\SecureTemplates.lua"]:338: in function handler'
[string "@FrameXML\SecureTemplates.lua"]:616: in function <FrameXML\SecureTemplates.lua:564>
[string "=[C]"]: ?
[string "@FrameXML\SecureHandlers.lua"]:266: in function <FrameXML\SecureHandlers.lua:263>
[string "=[C]"]: ?
[string "@FrameXML\SecureHandlers.lua"]:296: in function <FrameXML\SecureHandlers.lua:279>
[string "=(tail call)"]: ?

Locals:
(*temporary) = nil
(*temporary) = "player"

commented

Oh boy. Thank you for explanation, let me see it.
I am randomly getting "unknown unit ID" errors, but never a script error pointing to one of Buffomat sources, hence i never had a chance to catch it, while i play all my alts, all dungeons and raids with Buffomat enabled.

commented

I have included your suggested fix in the latest uploaded version 2022.1.0

commented

Closed due to 9982b57