From 45ffdbb284cced8544b70aa75e53a14fa66e0463 Mon Sep 17 00:00:00 2001 From: Martijn Bakker Date: Fri, 30 Sep 2016 00:40:13 +0100 Subject: [PATCH] fixed a segmentation fault when entering a cell which contains someone already attacking you --- apps/openmw/mwmechanics/aicombat.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/openmw/mwmechanics/aicombat.cpp b/apps/openmw/mwmechanics/aicombat.cpp index 6727be51b..2e1dfbac5 100644 --- a/apps/openmw/mwmechanics/aicombat.cpp +++ b/apps/openmw/mwmechanics/aicombat.cpp @@ -229,6 +229,9 @@ namespace MWMechanics osg::Vec3f vAimDir = MWBase::Environment::get().getWorld()->aimToTarget(actor, target); float distToTarget = MWBase::Environment::get().getWorld()->getHitDistance(actor, target); + if (!currentAction) + return; + storage.mReadyToAttack = (currentAction->isAttackingOrSpell() && distToTarget <= rangeAttack); // can't fight if attacker can't go where target is. E.g. A fish can't attack person on land.