Mercurial > wow > wowdb-profiler
diff Main.lua @ 43:15f2e3d8463b
Make sure spell_id is non-nil before attempting to record profession data.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Thu, 14 Jun 2012 12:28:40 -0500 |
parents | a2f1fcc1a813 |
children | 2a9bb8175562 |
line wrap: on
line diff
--- a/Main.lua Thu Jun 14 10:52:55 2012 -0500 +++ b/Main.lua Thu Jun 14 12:28:40 2012 -0500 @@ -1038,21 +1038,24 @@ DatamineTT:SetTrainerService(index) local _, _, spell_id = DatamineTT:GetSpell() - local profession, min_skill = _G.GetTrainerServiceSkillReq(index) - profession = profession or "General" - local class_professions = npc.teaches[PLAYER_CLASS] - if not class_professions then - npc.teaches[PLAYER_CLASS] = {} - class_professions = npc.teaches[PLAYER_CLASS] + if spell_id then + local profession, min_skill = _G.GetTrainerServiceSkillReq(index) + profession = profession or "General" + + local class_professions = npc.teaches[PLAYER_CLASS] + if not class_professions then + npc.teaches[PLAYER_CLASS] = {} + class_professions = npc.teaches[PLAYER_CLASS] + end + + local profession_skills = class_professions[profession] + if not profession_skills then + class_professions[profession] = {} + profession_skills = class_professions[profession] + end + profession_skills[spell_id] = ("%d:%d"):format(required_level, min_skill) end - - local profession_skills = class_professions[profession] - if not profession_skills then - class_professions[profession] = {} - profession_skills = class_professions[profession] - end - profession_skills[spell_id] = ("%d:%d"):format(required_level, min_skill) end end