From 2f66b91ac50b34c8e3b26f2a14f88a6d9a5cf81b Mon Sep 17 00:00:00 2001 From: Aussiemon Date: Fri, 16 Dec 2016 15:18:28 -0700 Subject: [PATCH] Added check to prevent attempted wandering of empty paths --- apps/openmw/mwmechanics/aiwander.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwmechanics/aiwander.cpp b/apps/openmw/mwmechanics/aiwander.cpp index e67c733f8..73ddce4b4 100644 --- a/apps/openmw/mwmechanics/aiwander.cpp +++ b/apps/openmw/mwmechanics/aiwander.cpp @@ -473,8 +473,8 @@ namespace MWMechanics void AiWander::onWalkingStatePerFrameActions(const MWWorld::Ptr& actor, float duration, AiWanderStorage& storage, ESM::Position& pos) { - // Are we there yet? - if (pathTo(actor, mPathFinder.getPath().back(), duration, DESTINATION_TOLERANCE)) + // Is there no destination or are we there yet? + if ((!mPathFinder.isPathConstructed()) || pathTo(actor, mPathFinder.getPath().back(), duration, DESTINATION_TOLERANCE)) { stopWalking(actor, storage); storage.setState(Wander_ChooseAction);