mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-31 23:45:32 +00:00
Compare initialized iterator
Comparsion of untilialized iterator is UB. Initialize with packages end.
This commit is contained in:
parent
e3cce0949e
commit
ca93f8ee39
1 changed files with 2 additions and 1 deletions
|
@ -223,7 +223,7 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac
|
||||||
// if active package is combat one, choose nearest target
|
// if active package is combat one, choose nearest target
|
||||||
if (packageTypeId == AiPackage::TypeIdCombat)
|
if (packageTypeId == AiPackage::TypeIdCombat)
|
||||||
{
|
{
|
||||||
std::list<AiPackage *>::iterator itActualCombat;
|
auto itActualCombat = mPackages.end();
|
||||||
|
|
||||||
float nearestDist = std::numeric_limits<float>::max();
|
float nearestDist = std::numeric_limits<float>::max();
|
||||||
osg::Vec3f vActorPos = actor.getRefData().getPosition().asVec3();
|
osg::Vec3f vActorPos = actor.getRefData().getPosition().asVec3();
|
||||||
|
@ -269,6 +269,7 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac
|
||||||
|
|
||||||
if (nearestDist < std::numeric_limits<float>::max() && mPackages.begin() != itActualCombat)
|
if (nearestDist < std::numeric_limits<float>::max() && mPackages.begin() != itActualCombat)
|
||||||
{
|
{
|
||||||
|
assert(itActualCombat != mPackages.end());
|
||||||
// move combat package with nearest target to the front
|
// move combat package with nearest target to the front
|
||||||
mPackages.splice(mPackages.begin(), mPackages, itActualCombat);
|
mPackages.splice(mPackages.begin(), mPackages, itActualCombat);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue