Commit fa0a0fa8 authored by Blazeflack's avatar Blazeflack

Fixed error when opening the ElvUI Bank

parent 13118b3d
local E = unpack(ElvUI)
local B = E:GetModule("Bags")
--Update Icon on bag slot
local function UpdateSlot(self, bagID, slotID)
if (self.Bags[bagID] and self.Bags[bagID].numSlots ~= GetContainerNumSlots(bagID)) or not self.Bags[bagID] or not self.Bags[bagID][slotID] then
return;
......@@ -8,26 +9,24 @@ local function UpdateSlot(self, bagID, slotID)
local slot = self.Bags[bagID][slotID]
local link = GetContainerItemLink(bagID, slotID);
local id
if link then
local id = tonumber(strmatch(link, 'item:(%d+)'))
if Scrap:IsJunk(id, bagID, slotID) then
return slot.JunkIcon:SetShown(Scrap_Icons)
end
id = tonumber(strmatch(link, 'item:(%d+)'))
end
slot.JunkIcon:Hide()
if slot.JunkIcon then
if id and Scrap:IsJunk(id, bagID, slotID) then
slot.JunkIcon:SetShown(Scrap_Icons)
else
slot.JunkIcon:Hide()
end
end
end
hooksecurefunc(B, "UpdateSlot", UpdateSlot)
-- Update Bags
local function UpdateBags()
for _, bagFrame in pairs(B.BagFrames) do
if bagFrame.UpdateAllSlots then
bagFrame:UpdateAllSlots()
end
end
B:UpdateAllBagSlots()
end
hooksecurefunc(Scrap, 'SettingsUpdated', UpdateBags)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment