mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-21 09:09:43 +00:00
Make sure PathFinder::getClosestPoint is not called with failing precondition
Pathgrid should be not nullptr and points should be not empty.
This commit is contained in:
parent
14516b9fd6
commit
d36595e09e
2 changed files with 4 additions and 1 deletions
|
@ -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…
Reference in a new issue