summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index fe3f1f45..6c802c5c 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -197,8 +197,10 @@ Item* LocalPlayer::searchForItem(int itemId)
{
for (int i = 0; i < INVENTORY_SIZE; i++)
{
- if (itemId == mInventory->getItem(i)->getId()) {
- return mInventory->getItem(i);
+ if (Item *item = mInventory->getItem(i)) {
+ if (item->getId() == itemId) {
+ return item;
+ }
}
}
return NULL;