1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-05 19:19:44 +00:00

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
This commit is contained in:
psi29a 2021-09-23 12:50:08 +00:00
parent 56869ec296
commit f0a77a48df
2 changed files with 4 additions and 1 deletions

View file

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

View file

@ -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);