AdiBags

AdiBags

8M Downloads

Error caused by hidden BankFrame when UpdateContainerFrameAnchors() is called

Elandril opened this issue ยท 0 comments

commented

There is an issue with AdiBags when UpdateContainerFrameAnchors() is called by any other addon, because Adibags moves the BankFrame to a hidden frame.

The underlying reason is Blizzard's UpdateContainerFrameAnchors() function in FrameXML/ContainerFrame.lua:820 (as of 6.0.3), where Bankframe:GetRight() is called, but the result is not checked against nil. The subsequent arithmetic operation causes the following error, when the Bank is opened every 5-10 seconds:

Interface\\FrameXML\\ContainerFrame.lua:820: attempt to perform arithmetic on a nil value
Backtrace:
Interface\\FrameXML\\ContainerFrame.lua:820: in function <Interface\\FrameXML\\ContainerFrame.lua:814>
[C]: ?
[C]: in function `UpdateContainerFrameAnchors'
Interface\\AddOns\\Titan\\TitanMovable.lua:351: in function `TitanMovableFrame_MoveFrames'
Interface\\AddOns\\Titan\\TitanMovable.lua:527: in function `TitanPanel_AdjustFrames'
Interface\\AddOns\\Titan\\TitanMovable.lua:542: in function `func'
...ce\\AddOns\\Skillet\\Libs\\AceTimer-3.0\\AceTimer-3.0-17.lua:55: in function <...ce\\AddOns\\Skillet\\Libs\\AceTimer-3.0\\AceTimer-3.0.lua:48>
Locals:
= <function> defined @Interface\\FrameXML\\ContainerFrame.lua:814
= <function> defined @Interface\\AddOns\\TradeSkillMaster\\Libs\\AceHook-3.0\\AceHook-3.0.lua:100

Here is a quick fix for this issue, which is inserted in Bags.lua line 35:

--<dirty fix
-- for a bug in Blizzard's function UpdateContainerFrameAnchors() in
-- FrameXML/ContainerFrame.lua:820 (as of 6.0.3), where Bankframe:GetRight()
-- is called, but the result is not checked against nil
addon.BankFrameGetRightOrig = _G.BankFrame.GetRight
function addon.BankFrameGetRight(self)
    local p = self:GetParent()
    if p and p:IsVisible() then 
        return addon.BankFrameGetRightOrig(self)
    else 
        return 0
    end
end
_G.BankFrame.GetRight = addon.BankFrameGetRight
--dirty fix>