Check for nullptr before dereferencing pathgrids

This commit is contained in:
Evil Eye 2025-08-12 11:02:10 +02:00
parent f5d866894e
commit 4707d7602d

View File

@ -636,6 +636,12 @@ namespace MWMechanics
const MWWorld::Cell& cell = *actor.getCell()->getCell();
const ESM::Pathgrid* pathgrid = world.getStore().get<ESM::Pathgrid>().search(cell);
// Moved to a cell without a pathgrid
if (pathgrid == nullptr)
{
storage.mAllowedPositions.clear();
return;
}
const PathgridGraph& pathgridGraph = getPathGridGraph(pathgrid);
const Misc::CoordinateConverter converter = Misc::makeCoordinateConverter(cell);