diff options
Diffstat (limited to 'src/player.cpp')
-rw-r--r-- | src/player.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/player.cpp b/src/player.cpp index 288c565d..d252f7a0 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -184,7 +184,8 @@ void Player::setSprite(unsigned int slot, int id, const std::string &color) if (equipmentSprite) equipmentSprite->setDirection(getSpriteDirection()); - delete mSprites[slot]; + if (mSprites[slot]) + delete mSprites[slot]; mSprites[slot] = equipmentSprite; @@ -196,6 +197,8 @@ void Player::setSprite(unsigned int slot, int id, const std::string &color) mSpriteIDs[slot] = id; mSpriteColors[slot] = color; + + _updateNumberOfLayers(); } void Player::setSpriteID(unsigned int slot, int id) |