summaryrefslogtreecommitdiff
path: root/src/inventory.cpp
diff options
context:
space:
mode:
authorFate <fate-tmw@googlemail.com>2008-11-28 21:58:11 -0700
committerFate <fate-tmw@googlemail.com>2008-11-28 21:58:11 -0700
commit84069b54947b3916329cbacf3211d1a68dfcfefa (patch)
tree5208f7795b4393a2e3333ad373fcb11d51279074 /src/inventory.cpp
parent5147a78f18990c037e66dd056ef99d63395a2746 (diff)
downloadmana-84069b54947b3916329cbacf3211d1a68dfcfefa.tar.gz
mana-84069b54947b3916329cbacf3211d1a68dfcfefa.tar.bz2
mana-84069b54947b3916329cbacf3211d1a68dfcfefa.tar.xz
mana-84069b54947b3916329cbacf3211d1a68dfcfefa.zip
Fixed potential segfault introduced while adding extra checks to inventory
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r--src/inventory.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 859213fe..58c75f2c 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -50,7 +50,7 @@ Inventory::~Inventory()
Item* Inventory::getItem(int index) const
{
- if (index < 0 || index >= INVENTORY_SIZE || mItems[index]->getQuantity() <= 0)
+ if (index < 0 || index >= INVENTORY_SIZE || !mItems[index] || mItems[index]->getQuantity() <= 0)
return 0;
return mItems[index];