Fixed an issue where a reagent map entry was being initialized with a null index value.
pschifferer [11-04-09 - 04:10]
Fixed an issue where a reagent map entry was being initialized with a null index value.
diff --git a/CauldronTradeskill.lua b/CauldronTradeskill.lua
index a951aae..c643c8f 100644
--- a/CauldronTradeskill.lua
+++ b/CauldronTradeskill.lua
@@ -159,7 +159,8 @@ function Cauldron:UpdateSkills()
end
-- populate the reagent list
- for j=1,GetTradeSkillNumReagents(i) do
+ local num = GetTradeSkillNumReagents(i);
+ for j=1,num do
local rName, rIcon, rCount, _ = GetTradeSkillReagentInfo(i, j);
-- Cauldron:info("UpdateSkills: i="..i..", j="..j..", rName="..tostring(rName)..", rIcon="..tostring(rIcon)..", rCount="..tostring(rCount));
local rLink = GetTradeSkillReagentItemLink(i, j);
@@ -170,7 +171,7 @@ function Cauldron:UpdateSkills()
-- Cauldron:info("UpdateSkills: key="..tostring(key));
if (not rName) or (not rIcon) or (not rLink) then
- Cauldron:error("Can't get name/icon/link for reagent! (skill: "..name..", reagentIndex: "..j..")");
+ Cauldron:error("Can't get name/icon/link for reagent! (skill: "..name..", reagentIndex: "..j..", name: "..rName..", icon: "..rIcon..", link: "..rLink..")");
end
local r = {
@@ -186,12 +187,13 @@ function Cauldron:UpdateSkills()
table.insert(skillDB.recipes[name].reagents, r);
-- add the reagent to the reagent map
- if not self.db.realm.userdata[self.vars.playername].reagentMap[rName] then
- self.db.realm.userdata[self.vars.playername].reagentMap[rName] = {};
- end
- table.insert(self.db.realm.userdata[self.vars.playername].reagentMap[rName], skillName..";"..recipeLink);
if rName then
+ if not self.db.realm.userdata[self.vars.playername].reagentMap[rName] then
+ self.db.realm.userdata[self.vars.playername].reagentMap[rName] = {};
+ end
+ table.insert(self.db.realm.userdata[self.vars.playername].reagentMap[rName], skillName..";"..recipeLink);
+
-- Cauldron:info("adding to keywords: "..tostring(keywords));
keywords = keywords..","..rName;
-- Cauldron:info("keywords="..tostring(keywords));