Don't crash OpGetTarget when the target disappeared (Fixes #3048)

openmw-38
scrawl 9 years ago
parent 3a81bed001
commit 14b143231c

@ -72,7 +72,7 @@ bool AiSequence::getCombatTarget(MWWorld::Ptr &targetActor) const
targetActor = combat->getTarget();
return true;
return !targetActor.isEmpty();
}
std::list<AiPackage*>::const_iterator AiSequence::begin() const

@ -424,7 +424,7 @@ namespace MWScript
MWWorld::Ptr targetPtr;
if (creatureStats.getAiSequence().getCombatTarget (targetPtr))
{
if (targetPtr.getCellRef().getRefId() == testedTargetId)
if (!targetPtr.isEmpty() && targetPtr.getCellRef().getRefId() == testedTargetId)
targetsAreEqual = true;
}
runtime.push(int(targetsAreEqual));

Loading…
Cancel
Save