From bead0d26642bbc0c5e570306c226676c66d18b86 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 2 Jun 2013 22:14:32 +0300 Subject: Add missing check in itemcontainer. --- src/gui/widgets/itemcontainer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 8e05097b5..146a2f328 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -608,8 +608,11 @@ int ItemContainer::getSlotIndex(const int x, const int y) const if (x < getWidth() && y < getHeight()) { const int idx = (y / mBoxHeight) * mGridColumns + (x / mBoxWidth); - if (idx < mGridRows * mGridColumns && mShowMatrix[idx] >= 0) + if (idx >= 0 && idx < mGridRows * mGridColumns + && mShowMatrix[idx] >= 0) + { return mShowMatrix[idx]; + } } return Inventory::NO_SLOT_INDEX; -- cgit v1.2.3-70-g09d2