summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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];