diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 19 |
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) { |