diff --git a/src/creatures/players/player.cpp b/src/creatures/players/player.cpp index 32899cc517e..339b26cfc0b 100644 --- a/src/creatures/players/player.cpp +++ b/src/creatures/players/player.cpp @@ -1140,8 +1140,8 @@ std::shared_ptr Player::getDepotLocker(uint32_t depotId) { depotBox->setParent(depotChest); inbox->setParent(depotLocker); - if (std::shared_ptr depotBox = getDepotChest(i, false)) { - depotBox->setParent(depotLocker->getItemByIndex(0)->getContainer()); + if (auto depotChestCache = getDepotChest(i, false)) { + depotChestCache->setParent(depotLocker->getItemByIndex(0)->getContainer()); } } depotLocker->internalAddThing(depotChest);