stab at the nil error - patch

manavortex [02-26-18 - 11:44]
stab at the nil error - patch
Filename
IIfA/IIfA.txt
IIfA/IIfAEvents.lua
diff --git a/IIfA/IIfA.txt b/IIfA/IIfA.txt
index 94589d0..0795d3f 100644
--- a/IIfA/IIfA.txt
+++ b/IIfA/IIfA.txt
@@ -1,6 +1,6 @@
 ## Title: Inventory Insight
 ## Author: manavortex, AssemblerManiac
-## Version: 3.09
+## Version: 3.09a
 ## APIVersion: 100022
 ## SavedVariables: IIfA_Settings IIfA_Data
 ## OptionalDependsOn: libFilters pChat
diff --git a/IIfA/IIfAEvents.lua b/IIfA/IIfAEvents.lua
index bfe7151..0568b7b 100644
--- a/IIfA/IIfAEvents.lua
+++ b/IIfA/IIfAEvents.lua
@@ -25,15 +25,15 @@ function IIfA:InventorySlotUpdate(eventCode, bagId, slotId, isNewItem, itemSound

 	local itemLink = GetItemLink(bagId, slotId, LINK_STYLE_BRACKETS) or ""
 	local itemKey = IIfA:GetItemKey(itemLink, nil, nil)		-- yes, the nil's can be left off, but this way we know it's supposed to take 3 args)
-	if #itemLink == 0 and IIfA.BagSlotInfo[bagId] ~= nil and IIfA.BagSlotInfo[bagId][slotId] then
+	if nil ~= itemLink and #itemLink == 0 and IIfA.BagSlotInfo[bagId] ~= nil and IIfA.BagSlotInfo[bagId][slotId] then
 		itemKey = IIfA.BagSlotInfo[bagId][slotId]
-		if #itemLink < 10 then
+		if nil ~= itemKey and #itemLink < 10 then
 			itemLink = IIfA.database[itemKey].itemLink
 		end
-	elseif #itemLink > 0 and IIfA.BagSlotInfo[bagId] == nil then
+	elseif nil ~= itemLink and #itemLink > 0 and IIfA.BagSlotInfo[bagId] == nil then
 		IIfA.BagSlotInfo[bagId] = {}
 		IIfA.BagSlotInfo[bagId][slotId] = itemKey
-	elseif #itemLink > 0 and IIfA.BagSlotInfo[bagId][slotId] == nil then
+	elseif nil ~= itemLink and #itemLink > 0 and IIfA.BagSlotInfo[bagId][slotId] == nil then
 		IIfA.BagSlotInfo[bagId][slotId] = itemKey
 	end