more fixes

git [02-15-18 - 20:17]
more fixes
Filename
IIfA/IIfA.lua
IIfA/IIfAEvents.lua
diff --git a/IIfA/IIfA.lua b/IIfA/IIfA.lua
index 3fc3f50..9f1e363 100644
--- a/IIfA/IIfA.lua
+++ b/IIfA/IIfA.lua
@@ -518,18 +518,21 @@ function IIfA:MakeBSI()
 	local idx
 	local itemLink, DBItem, locname, data
 	for itemLink, DBItem in pairs(IIfA.database) do
-		for locname, data in pairs(DBItem.locations) do
-			if ((data.bagID == BAG_BACKPACK or data.bagID == BAG_WORN) and locname == IIfA.currentCharacterId) or	-- only index items ON this character if they're in backpack
-				(data.bagID ~= BAG_BACKPACK and data.bagID ~= BAG_WORN) then
-				idx = data.bagID
-				if idx == BAG_GUILDBANK then		-- replace idx with appropriate guild bank name instead of the ID for BAG_GUILDBANK (to differentiate guild banks)
-					idx = locname
-				end
-				if bs[idx] == nil then
-					bs[idx] = {}
+		if DBItem.locations then
+			for locname, data in pairs(DBItem.locations) do
+				if ((data.bagID == BAG_BACKPACK or data.bagID == BAG_WORN) and locname == IIfA.currentCharacterId) or	-- only index items ON this character if they're in backpack
+					(data.bagID ~= BAG_BACKPACK and data.bagID ~= BAG_WORN) then
+					idx = data.bagID
+					if idx == BAG_GUILDBANK then		-- replace idx with appropriate guild bank name instead of the ID for BAG_GUILDBANK (to differentiate guild banks)
+						idx = locname
+					end
+					if bs[idx] == nil then
+						bs[idx] = {}
+					end
+					if nil ~= idx and nil ~= data.bagSlot then
+						bs[idx][data.bagSlot] = itemLink
+					end
 				end
-
-				bs[idx][data.bagSlot] = itemLink
 			end
 		end
 	end
diff --git a/IIfA/IIfAEvents.lua b/IIfA/IIfAEvents.lua
index db7a29c..fefbee2 100644
--- a/IIfA/IIfAEvents.lua
+++ b/IIfA/IIfAEvents.lua
@@ -16,12 +16,12 @@ end
 -- used by an event function
 function IIfA:InventorySlotUpdate(eventCode, bagId, slotId, isNewItem, itemSoundCategory, inventoryUpdateReason, qty)

+	if nil == bagId then return end
 	if isNewItem then
 		isNewItem = "True"
 	else
 		isNewItem = "False"
 	end
-
 	local itemLink = GetItemLink(bagId, slotId, LINK_STYLE_BRACKETS) or ""
 	if #itemLink == 0 and IIfA.BagSlotInfo[bagId] ~= nil and IIfA.BagSlotInfo[bagId][slotId] then
 		itemLink = IIfA.BagSlotInfo[bagId][slotId]