From d9443c2845764dd2e6842b4aec9528c79213cabe Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sat, 27 Jun 2009 10:17:19 -0600 Subject: Prevent selection of out of range menu options --- src/gui/npcdialog.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/gui') 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]; -- cgit v1.2.3-70-g09d2