changeset 28:4317e56e0a91

Fixed some crash issues with items and gems
author Adam tegen <adam.tegen@gmail.com>
date Fri, 17 Oct 2014 00:08:54 -0500
parents 0eb7f9a8e9a2
children aabec73640a0
files AskMrRobot.toc amr-constants.lua ui/ItemLinkText.lua ui/JewelPanel.lua
diffstat 4 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/AskMrRobot.toc	Wed Oct 15 19:08:21 2014 -0500
+++ b/AskMrRobot.toc	Fri Oct 17 00:08:54 2014 -0500
@@ -1,7 +1,7 @@
 ## Interface: 60000
 ## Title: Ask Mr. Robot
 ## Author: Team Robot, Inc.
-## Version: 6
+## Version: 7
 ## Notes: Exports/Imports data to/from askmrrobot.com.
 ## URL: www.askmrrobot.com
 ## DefaultState: Enabled
--- a/amr-constants.lua	Wed Oct 15 19:08:21 2014 -0500
+++ b/amr-constants.lua	Fri Oct 17 00:08:54 2014 -0500
@@ -23,7 +23,7 @@
     --item.difficultyId = tonumber(parts[11])
     
     local numBonuses = tonumber(parts[12])
-    if numBonuses > 0 then
+    if numBonuses and numBonuses > 0 then
         item.bonusIds = {}
         for i = 13, 12 + numBonuses do
             table.insert(item.bonusIds, tonumber(parts[i]))
--- a/ui/ItemLinkText.lua	Wed Oct 15 19:08:21 2014 -0500
+++ b/ui/ItemLinkText.lua	Fri Oct 17 00:08:54 2014 -0500
@@ -24,7 +24,7 @@
 function AskMrRobot.ItemLinkText:SetItemId(itemId, upgradeId, suffixId)
 	AskMrRobot.ItemTooltipFrame.SetItemLink(self, link)
 	self.itemName = nil
-	if itemId > 0 then
+	if itemId and itemId > 0 then
 		local linkTemplate = "item:%d:0:0:0:0:0:%d:0:%d:0:%d"
 		local itemName, itemLink = GetItemInfo(linkTemplate:format(itemId, suffixId, UnitLevel("player"), upgradeId))
 		self:SetItemLink(itemLink)
--- a/ui/JewelPanel.lua	Wed Oct 15 19:08:21 2014 -0500
+++ b/ui/JewelPanel.lua	Fri Oct 17 00:08:54 2014 -0500
@@ -114,7 +114,7 @@
 		--if i <= #optimizedGems or currentGemLink then
 		if i <= #optimizedGems or currentGemLink then
 			local optimizedGemId = 0
-			if optimizedGems[i] > 0 then
+			if optimizedGems[i] and optimizedGems[i] > 0 then
 				optimizedGemId = AskMrRobot.ExtraGemData[optimizedGems[i]].id
 			end
 			--local currentGemId = AskMrRobot.ExtraGemData[showGems[i]].id
@@ -141,7 +141,7 @@
 
 			--if showGems[i] and optimizedGems[i] and optimizedGems[i].color then
 			--if test and optimizedGems[i] and optimizedGems[i].color then
-			if mismatched and optimizedGems[i] > 0 then
+			if mismatched and optimizedGems[i] and optimizedGems[i] > 0 then
 				gemCount = gemCount + 1
 				-- set the optimized gem text
 				text:SetTextColor(1,1,1)