From 4707d7602d4d273395cb1a48770ad5c9d70b04d9 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Tue, 12 Aug 2025 11:02:10 +0200 Subject: [PATCH] Check for nullptr before dereferencing pathgrids --- apps/openmw/mwmechanics/aiwander.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/openmw/mwmechanics/aiwander.cpp b/apps/openmw/mwmechanics/aiwander.cpp index ad4fc730df..332f7e6545 100644 --- a/apps/openmw/mwmechanics/aiwander.cpp +++ b/apps/openmw/mwmechanics/aiwander.cpp @@ -636,6 +636,12 @@ namespace MWMechanics const MWWorld::Cell& cell = *actor.getCell()->getCell(); const ESM::Pathgrid* pathgrid = world.getStore().get().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);