diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-06-27 10:17:19 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-06-27 10:17:19 -0600 |
commit | d9443c2845764dd2e6842b4aec9528c79213cabe (patch) | |
tree | 14a863c6c2928d837672d006b35e60c8e49faf3c /src/gui/npcdialog.cpp | |
parent | 82431b7cc3ee57174981fec541c96c2e3344432d (diff) | |
download | mana-d9443c2845764dd2e6842b4aec9528c79213cabe.tar.gz mana-d9443c2845764dd2e6842b4aec9528c79213cabe.tar.bz2 mana-d9443c2845764dd2e6842b4aec9528c79213cabe.tar.xz mana-d9443c2845764dd2e6842b4aec9528c79213cabe.zip |
Prevent selection of out of range menu options
Diffstat (limited to 'src/gui/npcdialog.cpp')
-rw-r--r-- | src/gui/npcdialog.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index c4b1ec88..a61df69f 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -172,7 +172,11 @@ void NpcDialog::action(const gcn::ActionEvent &event) int choice = 0; int selectedIndex = mItemList->getSelected(); - if (selectedIndex > -1) + if (selectedIndex >= mItems.size()) + { + return; + } + else if (selectedIndex > -1) { choice = selectedIndex + 1; printText = mItems[selectedIndex]; |