From aa488ea3fa37c132b7b0bd4a91f2014d25756a06 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 24 Jul 2013 21:48:29 +0300 Subject: Dont save errors about item id 0 in logs. --- src/being.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/being.cpp b/src/being.cpp index 2fa5b7599..0c3e1160b 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -1883,12 +1883,16 @@ void Being::setSprite(const unsigned int slot, const int id, if (isWeapon) mEquippedWeapon = nullptr; - const ItemInfo &info = ItemDB::get(mSpriteIDs[slot]); - if (mMap) + const int id1 = mSpriteIDs[slot]; + if (id1) { - const int pet = info.getPet(); - if (pet) - removePet(); + const ItemInfo &info = ItemDB::get(id1); + if (mMap) + { + const int pet = info.getPet(); + if (pet) + removePet(); + } } } else @@ -2980,7 +2984,10 @@ void Being::updatePets() removePet(); FOR_EACH (std::vector::const_iterator, it, mSpriteIDs) { - const ItemInfo &info = ItemDB::get(*it); + const int id = *it; + if (!id) + continue; + const ItemInfo &info = ItemDB::get(id); const int pet = info.getPet(); if (pet) { -- cgit v1.2.3-70-g09d2