summaryrefslogtreecommitdiff
path: root/src/gui/npcdialog.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-06-27 10:17:19 -0600
committerJared Adams <jaxad0127@gmail.com>2009-06-27 10:17:19 -0600
commitd9443c2845764dd2e6842b4aec9528c79213cabe (patch)
tree14a863c6c2928d837672d006b35e60c8e49faf3c /src/gui/npcdialog.cpp
parent82431b7cc3ee57174981fec541c96c2e3344432d (diff)
downloadmana-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
Diffstat (limited to 'src/gui/npcdialog.cpp')
-rw-r--r--src/gui/npcdialog.cpp6
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];