mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-21 06:14:05 +00:00
[Client] Don't crash when dying while inside a container
This commit is contained in:
parent
443c0ed309
commit
90275f777e
1 changed files with 13 additions and 8 deletions
|
@ -70,6 +70,9 @@ void mwmp::WorldController::closeContainer(const MWWorld::Ptr &container)
|
||||||
{
|
{
|
||||||
mwmp::Main::get().getLocalPlayer()->clearCurrentContainer();
|
mwmp::Main::get().getLocalPlayer()->clearCurrentContainer();
|
||||||
|
|
||||||
|
// If the player died while in a container, the container's Ptr could be invalid now
|
||||||
|
if (!container.isEmpty())
|
||||||
|
{
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Container \"%s\" (%d) is closed.",
|
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Container \"%s\" (%d) is closed.",
|
||||||
container.getCellRef().getRefId().c_str(),
|
container.getCellRef().getRefId().c_str(),
|
||||||
container.getCellRef().getRefNum().mIndex);
|
container.getCellRef().getRefNum().mIndex);
|
||||||
|
@ -80,5 +83,7 @@ void mwmp::WorldController::closeContainer(const MWWorld::Ptr &container)
|
||||||
LOG_APPEND(Log::LOG_VERBOSE, " - Item. Refid: \"%s\" Count: %d",
|
LOG_APPEND(Log::LOG_VERBOSE, " - Item. Refid: \"%s\" Count: %d",
|
||||||
iter->getCellRef().getRefId().c_str(), iter->getRefData().getCount());
|
iter->getCellRef().getRefId().c_str(), iter->getRefData().getCount());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mwmp::Main::get().getLocalPlayer()->updateInventory();
|
mwmp::Main::get().getLocalPlayer()->updateInventory();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue