diff options
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index ee82445f7..7176c4103 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -430,15 +430,21 @@ SkillInfo* SkillDialog::getSkillByItem(const int itemId) const void SkillDialog::setSkillDuration(const int id, const int duration) { SkillMap::const_iterator it = mSkills.find(id); + SkillInfo *info = nullptr; + if (it == mSkills.end()) + { + addSkill(id, "", 0, 0, false, SkillType::Unknown, 0); + it = mSkills.find(id); + } if (it != mSkills.end()) { - SkillInfo *const info = (*it).second; - if (info) - { - info->duration = duration; - info->durationTime = tick_time; - addSkillDuration(info); - } + info = (*it).second; + } + if (info) + { + info->duration = duration; + info->durationTime = tick_time; + addSkillDuration(info); } } |