Merge branch 'check_pathgrid' into 'master'

Make sure PathFinder::getClosestPoint is not called with failing precondition (#6294)

Closes #6294

See merge request OpenMW/openmw!1236

(cherry picked from commit baa33799de3cb27d9d3805e164b9d7ccea6a3e4d)

d36595e0 Make sure PathFinder::getClosestPoint is not called with failing precondition
pull/593/head
psi29a 3 years ago
parent 56869ec296
commit f0a77a48df

@ -346,7 +346,7 @@ namespace MWMechanics
bool runFallback = true;
if (pathgrid && !actor.getClass().isPureWaterCreature(actor))
if (pathgrid != nullptr && !pathgrid->mPoints.empty() && !actor.getClass().isPureWaterCreature(actor))
{
ESM::Pathgrid::PointList points;
Misc::CoordinateConverter coords(storage.mCell->getCell());

@ -754,6 +754,9 @@ namespace MWMechanics
const ESM::Pathgrid *pathgrid =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(*currentCell->getCell());
if (pathgrid == nullptr || pathgrid->mPoints.empty())
return;
int index = PathFinder::getClosestPoint(pathgrid, PathFinder::makeOsgVec3(dest));
getPathGridGraph(currentCell).getNeighbouringPoints(index, points);

Loading…
Cancel
Save