diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-06-02 22:14:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-06-02 22:14:32 +0300 |
commit | bead0d26642bbc0c5e570306c226676c66d18b86 (patch) | |
tree | 17bc2665b3321698e555ca55fab9168f4e796e08 /src/gui/widgets/itemcontainer.cpp | |
parent | 0c7b839dd83d1ee0589570119dc64cd5826fcbf2 (diff) | |
download | mv-bead0d26642bbc0c5e570306c226676c66d18b86.tar.gz mv-bead0d26642bbc0c5e570306c226676c66d18b86.tar.bz2 mv-bead0d26642bbc0c5e570306c226676c66d18b86.tar.xz mv-bead0d26642bbc0c5e570306c226676c66d18b86.zip |
Add missing check in itemcontainer.
Diffstat (limited to 'src/gui/widgets/itemcontainer.cpp')
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 5 |
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; |