summaryrefslogtreecommitdiff
path: root/src/inventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r--src/inventory.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 39860261..63fbab7a 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -44,6 +44,11 @@ Inventory::~Inventory()
Item* Inventory::getItem(int index)
{
+ if (index < 0 || index > INVENTORY_SIZE)
+ {
+ return 0;
+ }
+
return &items[index];
}