1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-28 13:09:40 +00:00

[Client] Fix crash by not trying to enable markers for invalid players

This commit is contained in:
David Cernat 2019-08-26 21:10:02 +03:00
parent 78a9a428a6
commit 3e1c96a49c
2 changed files with 5 additions and 0 deletions

View file

@ -358,6 +358,8 @@ MWWorld::CellStore *CellController::getCellStore(const ESM::Cell& cell)
bool CellController::isSameCell(const ESM::Cell& cell, const ESM::Cell& otherCell) bool CellController::isSameCell(const ESM::Cell& cell, const ESM::Cell& otherCell)
{ {
if (&cell == nullptr || &otherCell == nullptr) return false;
if (cell.isExterior() && otherCell.isExterior()) if (cell.isExterior() && otherCell.isExterior())
{ {
if (cell.mData.mX == otherCell.mData.mX && cell.mData.mY == otherCell.mData.mY) if (cell.mData.mX == otherCell.mData.mX && cell.mData.mY == otherCell.mData.mY)

View file

@ -96,6 +96,9 @@ void PlayerList::enableMarkers(const ESM::Cell& cell)
{ {
for (auto &playerEntry : players) for (auto &playerEntry : players)
{ {
if (playerEntry.second == nullptr || playerEntry.second->getPtr().mRef == nullptr)
continue;
if (Main::get().getCellController()->isSameCell(cell, playerEntry.second->cell)) if (Main::get().getCellController()->isSameCell(cell, playerEntry.second->cell))
{ {
playerEntry.second->enableMarker(); playerEntry.second->enableMarker();