summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-07-24 21:48:29 +0300
committerAndrei Karas <akaras@inbox.ru>2013-07-24 21:48:57 +0300
commitaa488ea3fa37c132b7b0bd4a91f2014d25756a06 (patch)
tree0ce337fa9a380fc1bc4a8d5d2d58da2aa82ec427
parent91075015ad4b5bd576c1a5668a11ea0227dd6bd1 (diff)
downloadmv-aa488ea3fa37c132b7b0bd4a91f2014d25756a06.tar.gz
mv-aa488ea3fa37c132b7b0bd4a91f2014d25756a06.tar.bz2
mv-aa488ea3fa37c132b7b0bd4a91f2014d25756a06.tar.xz
mv-aa488ea3fa37c132b7b0bd4a91f2014d25756a06.zip
Dont save errors about item id 0 in logs.
-rw-r--r--src/being.cpp19
1 files changed, 13 insertions, 6 deletions
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<int>::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)
{