diff options
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r-- | src/inventory.cpp | 5 |
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]; } |