summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-06-02 22:14:32 +0300
committerAndrei Karas <akaras@inbox.ru>2013-06-02 22:14:32 +0300
commitbead0d26642bbc0c5e570306c226676c66d18b86 (patch)
tree17bc2665b3321698e555ca55fab9168f4e796e08 /src/gui
parent0c7b839dd83d1ee0589570119dc64cd5826fcbf2 (diff)
downloadplus-bead0d26642bbc0c5e570306c226676c66d18b86.tar.gz
plus-bead0d26642bbc0c5e570306c226676c66d18b86.tar.bz2
plus-bead0d26642bbc0c5e570306c226676c66d18b86.tar.xz
plus-bead0d26642bbc0c5e570306c226676c66d18b86.zip
Add missing check in itemcontainer.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/itemcontainer.cpp5
1 files changed, 4 insertions, 1 deletions
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;