diff options
Diffstat (limited to 'src/gui/skilldialog.cpp')
-rw-r--r-- | src/gui/skilldialog.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 1f36d6de9..672928551 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -629,14 +629,20 @@ void SkillDialog::addSkill(const int id, const int level, const int range, } } -SkillInfo* SkillDialog::getSkill(const int id) +SkillInfo* SkillDialog::getSkill(const int id) const { - return mSkills[id]; + SkillMap::const_iterator it = mSkills.find(id); + if (it != mSkills.end()) + return (*it).second; + return nullptr; } -SkillInfo* SkillDialog::getSkillByItem(const int itemId) +SkillInfo* SkillDialog::getSkillByItem(const int itemId) const { - return mSkills[itemId - SKILL_MIN_ID]; + SkillMap::const_iterator it = mSkills.find(itemId - SKILL_MIN_ID); + if (it != mSkills.end()) + return (*it).second; + return nullptr; } void SkillDialog::widgetResized(const gcn::Event &event) |