comparison ReagentMaker.lua @ 23:8acb6dc1ff9e

Avoid a lua error when the reagent is not found
author contrebasse
date Wed, 27 Apr 2011 21:55:33 +0200
parents 25b9f98f9bba
children 5f3a5b88fb19
comparison
equal deleted inserted replaced
22:a5a3e5e14ef7 23:8acb6dc1ff9e
40 return 40 return
41 end 41 end
42 42
43 -- Scan availabe recipes 43 -- Scan availabe recipes
44 A:ScanSimpleRecipes() 44 A:ScanSimpleRecipes()
45 45
46 -- Show makables reagents 46 -- Show makables reagents
47 A.updateCounts(GetTradeSkillSelectionIndex()) 47 A.updateCounts(GetTradeSkillSelectionIndex())
48 end 48 end
49 end 49 end
50 A.EventsFrame:SetScript("OnEvent", function(self, event) 50 A.EventsFrame:SetScript("OnEvent", function(self, event)
201 -- Tooltips 201 -- Tooltips
202 local link 202 local link
203 if A.data[reagentID].spell then 203 if A.data[reagentID].spell then
204 link = GetSpellLink(A.data[reagentID].spellID) 204 link = GetSpellLink(A.data[reagentID].spellID)
205 else 205 else
206 link = GetTradeSkillRecipeLink(A.findSkillIndex(reagentID)) 206 local index = A.findSkillIndex(reagentID)
207 if index then
208 link = GetTradeSkillRecipeLink(A.findSkillIndex(reagentID))
209 end
207 end 210 end
208 if link then 211 if link then
209 A.tooltipRecipe:SetOwner(btn) 212 A.tooltipRecipe:SetOwner(btn)
210 A.tooltipRecipe:SetHyperlink(link) 213 A.tooltipRecipe:SetHyperlink(link)
211 A.tooltipRecipe:Show() 214 A.tooltipRecipe:Show()