Quantcast

Fix an error that can occur when only one trinket slot has a winner

James Whitehead II [08-17-08 - 13:42]
Fix an error that can occur when only one trinket slot has a winner
Filename
DressToKill.lua
diff --git a/DressToKill.lua b/DressToKill.lua
index 624edcd..c7056b1 100644
--- a/DressToKill.lua
+++ b/DressToKill.lua
@@ -296,11 +296,14 @@ local function scanFunction(weightFunction)
 				debug(L["Item blacklisted, skipping..."])
 			end
 		end
-		-- Now equip the item that won this round and blacklist
-		DressToKill:EquipItem(slotId, winner, stash)
-		local link = GetInventoryItemLink("player", slotId)
-		print("Choosing %s", link)
-		blacklist[winner] = true
+		-- Now equip the item that won this round and blacklist assuming there was a winner
+		if winner then
+			DressToKill:EquipItem(slotId, winner, stash)
+			local link = GetInventoryItemLink("player", slotId)
+			debug(L["Choosing %s for this slot"], link)
+			blacklist[winner] = true
+		else
+			debug(L["There was no winner from this round, not enough trinkets or rings?"])
 	end
 	UIErrorsFrame:AddMessage("Scan complete!", 0.2, 1, 0.2)
 	print("Evaluation complete!")