diff options
-rw-r--r-- | src/gui/skilldialog.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 063e29939..1d0c12001 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -67,7 +67,11 @@ class SkillModel final : public gcn::ListModel { return static_cast<int>(mVisibleSkills.size()); } SkillInfo *getSkillAt(const int i) const - { return mVisibleSkills.at(i); } + { + if (i < 0 || i >= static_cast<int>(mVisibleSkills.size())) + return nullptr; + return mVisibleSkills.at(i); + } std::string getElementAt(int i) { |