- Fixed bug causing ESO to crash when hovering over a guild store listing item

Yaron Kfir [07-11-14 - 04:36]
 - Fixed bug causing ESO to crash when hovering over a guild store listing item
 - Cleaning stale items now works as expected
 - Item levels are now calculated as expected
 - Fixed variable leak
Filename
Changelog
PriceTracker.lua
PriceTracker.txt
diff --git a/Changelog b/Changelog
index 22f8966..549f0f4 100644
--- a/Changelog
+++ b/Changelog
@@ -1,5 +1,11 @@
 Changelog

+v1.9
+ - Fixed bug causing ESO to crash when hovering over a guild store listing item
+ - Cleainig stale items now works as expected
+ - Item levels are now calculated as expected
+ - Fixed variable leak
+
 v1.8
  - 'Scan Prices' button is enabled only after the search cooldown is reached

diff --git a/PriceTracker.lua b/PriceTracker.lua
index 420e1b2..8fc1a8d 100644
--- a/PriceTracker.lua
+++ b/PriceTracker.lua
@@ -117,6 +117,7 @@ function PriceTracker:Housekeeping()
 end

 function PriceTracker:OnUpdateTooltip(item, tooltip)
+	local _
 	if not tooltip then tooltip = ItemTooltip end
 	if not item or not item.dataEntry or not item.dataEntry.data or not self.menu:IsKeyPressed() or self.selectedItem[tooltip] == item then return end
 	self.selectedItem[tooltip] = item
@@ -132,8 +133,14 @@ function PriceTracker:OnUpdateTooltip(item, tooltip)
 			_, _, _, itemId, _, level = ZO_LinkHandler_ParseLink(GetItemLink(item.dataEntry.data.searchData.bagId, item.dataEntry.data.searchData.slotIndex, item.dataEntry.data.searchData.type))
 		end
 		if item.dataEntry.data.itemIndex then
-			-- Must be a store item
-			_, _, _, itemId, _, level = ZO_LinkHandler_ParseLink(GetTradingHouseSearchResultItemLink(item.dataEntry.data.itemIndex))
+			if ZO_TradingHouseMenuBarButton1.m_object.m_state == 1 then
+				-- Must be a store search item
+				_, _, _, itemId, _, level = ZO_LinkHandler_ParseLink(GetTradingHouseSearchResultItemLink(item.dataEntry.data.itemIndex))
+			end
+			if ZO_TradingHouseMenuBarButton3.m_object.m_state == 1 then
+				-- Must be a store listing item
+				_, _, _, itemId, _, level = ZO_LinkHandler_ParseLink(GetTradingHouseListingItemLink(item.dataEntry.data.itemIndex))
+			end
 		end
 	end

@@ -236,7 +243,7 @@ function PriceTracker:OnLinkClicked(rawLink, mouseButton, linkText, color, linkT
 	if linkType ~= "item" then return end

 	local _, sellPrice, _, _, _ = GetItemLinkInfo(rawLink)
-	local _, _, _, _, level = ZO_LinkHandler_ParseLink(rawLink)
+	local _, _, _, _, _, level = ZO_LinkHandler_ParseLink(rawLink)
 	local item = {
 		dataEntry = {
 			data = {
@@ -293,10 +300,12 @@ end

 function PriceTracker:CleanItemList()
 	local timestamp = GetTimeStamp()
-	for k, v in pairs(PriceTracker.settings.itemList) do
-		for itemK, itemV in pairs(v) do
-			if itemV.expiry > timestamp then
-				table.remove(v, itemK)
+	for k, v in pairs(self.settings.itemList) do
+		for level, item in pairs(v) do
+			for itemK, itemV in pairs(item) do
+				if itemV.expiry > timestamp then
+					table.remove(item, itemK)
+				end
 			end
 		end
 	end
diff --git a/PriceTracker.txt b/PriceTracker.txt
index 3c1b8ca..bb32cfa 100644
--- a/PriceTracker.txt
+++ b/PriceTracker.txt
@@ -1,6 +1,6 @@
 ## Title: PriceTracker
 ## Author: Barvazon
-## Version: 1.8
+## Version: 1.9
 ## SavedVariables: PriceTrackerSettings
 ## APIVersion: 100007
 ## OptionalDependsOn: LibAddonMenu-2.0