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
pull/3128/head
psi29a 3 years ago
commit baa33799de

@ -348,7 +348,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());

@ -758,6 +758,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