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 | |
parent | 82431b7cc3ee57174981fec541c96c2e3344432d (diff) | |
download | mana-client-d9443c2845764dd2e6842b4aec9528c79213cabe.tar.gz mana-client-d9443c2845764dd2e6842b4aec9528c79213cabe.tar.bz2 mana-client-d9443c2845764dd2e6842b4aec9528c79213cabe.tar.xz mana-client-d9443c2845764dd2e6842b4aec9528c79213cabe.zip |
Prevent selection of out of range menu options
-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]; |