Quantcast

For some reason bagID was returning nil for bank when B:Layout() is called for the first time and no currencies are tracked. This fixes #390

Darth Predator [11-09-16 - 15:23]
For some reason bagID was returning nil for bank when B:Layout() is called for the first time and no currencies are tracked. This fixes #390
Filename
ElvUI_SLE/modules/bags/bags.lua
diff --git a/ElvUI_SLE/modules/bags/bags.lua b/ElvUI_SLE/modules/bags/bags.lua
index 73d0aa0..d42e1a5 100644
--- a/ElvUI_SLE/modules/bags/bags.lua
+++ b/ElvUI_SLE/modules/bags/bags.lua
@@ -135,18 +135,24 @@ function SB:HookBags(isBank, force)
 		for _, bagID in T.pairs(bagFrame.BagIDs) do
 			if (not self.hookedBags[bagID])then
 				for slotID = 1, T.GetContainerNumSlots(bagID) do
-					slot = bagFrame.Bags[bagID][slotID];
-					self:HookSlot(slot, bagID, slotID);
+					if bagFrame.Bags[bagID] then
+						slot = bagFrame.Bags[bagID][slotID];
+						self:HookSlot(slot, bagID, slotID);
+					end
 				end
 				self.hookedBags[bagID] = true;
 			elseif self.hookedBags[bagID] and force then
 				for slotID = 1, T.GetContainerNumSlots(bagID) do
-					if force == bagFrame.Bags[bagID][slotID] then self:HookSlot(force, bagID, slotID) end
+					if bagFrame.Bags[bagID] then
+						if force == bagFrame.Bags[bagID][slotID] then self:HookSlot(force, bagID, slotID) end
+					end
 				end
 			end
 			for slotID = 1, T.GetContainerNumSlots(bagID) do
-				slot = bagFrame.Bags[bagID][slotID];
-				if slot.template ~= "Transparent" and E.private.sle.bags.transparentSlots then slot:SetTemplate('Transparent') end
+				if bagFrame.Bags[bagID] then
+					slot = bagFrame.Bags[bagID][slotID];
+					if slot.template ~= "Transparent" and E.private.sle.bags.transparentSlots then slot:SetTemplate('Transparent') end
+				end
 			end
 		end
 	end