Quantcast

* fixed 'compare with nil' error when using Enchantrix

ckaotik [12-05-10 - 10:20]
* fixed 'compare with nil' error when using Enchantrix
* fixed LPT not being properly recognized
Filename
core.lua
helper.lua
diff --git a/core.lua b/core.lua
index 56ec61f..de0448a 100644
--- a/core.lua
+++ b/core.lua
@@ -418,7 +418,7 @@ function BrokerGarbage:GetSingleItemValue(item)
         auctionPrice = math.max(auctionPrice, AucAdvanced.API.GetMarketValue(itemLink))

         if IsAddOnLoaded("Enchantrix") then
-            disenchantPrice = canDE and math.max(disenchantPrice, select(3, Enchantrix.Storage.GetItemDisenchantTotals(itemLink)))
+            disenchantPrice = canDE and math.max(disenchantPrice, select(3, Enchantrix.Storage.GetItemDisenchantTotals(itemLink)) or 0)
         end
     end

@@ -436,9 +436,9 @@ function BrokerGarbage:GetSingleItemValue(item)
             local tmpPrice = 0
             local DEData = Wowecon.API.GetDisenchant_ByLink(itemLink)
             for i, data in pairs(DEData) do	-- [1] = item link, [2] = quantity, [3] = chance
-                tmpPrice = tmpPrice + (Wowecon.API.GetAuctionPrice_ByLink(data[1]) * data[2] * data[3])
+                tmpPrice = tmpPrice + ((Wowecon.API.GetAuctionPrice_ByLink(data[1] or 0)) * data[2] * data[3])
             end
-            disenchantPrice = math.max(disenchantPrice, math.floor(tmpPrice))
+            disenchantPrice = math.max(disenchantPrice, math.floor(tmpPrice or 0))
         end
 	end

diff --git a/helper.lua b/helper.lua
index 01ff64c..b4fb2b1 100644
--- a/helper.lua
+++ b/helper.lua
@@ -325,37 +325,6 @@ function BrokerGarbage:ResetAll(global)
 	end
 end

-local interestingPTSets = {"Consumable", "Misc", "Tradeskill"}
-BrokerGarbage.PTSets = {}
-for set, _ in pairs( BrokerGarbage.PT and BrokerGarbage.PT.sets or {} ) do
-	local interesting = false
-	local partials = { strsplit(".", set) }
-	local maxParts = #partials
-
-	for i = 1, #interestingPTSets do
-		if strfind(partials[1], interestingPTSets[i]) then
-			interesting = true
-			break
-		end
-	end
-
-	if interesting then
-		local pre = BrokerGarbage.PTSets
-
-		for i = 1, maxParts do
-			if i == maxParts then
-				-- actual clickable entries
-				pre[ partials[i] ] = set
-			else
-				-- all parts before that
-				if not pre[ partials[i] ] or type(pre[ partials[i] ]) == "string" then
-					pre[ partials[i] ] = {}
-				end
-				pre = pre[ partials[i] ]
-			end
-		end
-	end
-end
 function BrokerGarbage:LPTDropDown(self, level, functionHandler)
 	local dataTable = BrokerGarbage.PTSets or {}
 	if UIDROPDOWNMENU_MENU_VALUE and string.find(UIDROPDOWNMENU_MENU_VALUE, ".") then