From 84069b54947b3916329cbacf3211d1a68dfcfefa Mon Sep 17 00:00:00 2001 From: Fate Date: Fri, 28 Nov 2008 21:58:11 -0700 Subject: Fixed potential segfault introduced while adding extra checks to inventory --- src/inventory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/inventory.cpp') 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]; -- cgit v1.2.3-70-g09d2