1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-19 19:53:53 +00:00

Replace condition that may lead to UB by assert

If mPackages is empty it means package is a pointer to a deleted object
at line . We can assume it couldn't happen because execute is always called
next for this object at line 289.
This commit is contained in:
elsid 2020-05-17 17:24:47 +02:00
parent b168544445
commit e3cce0949e
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40

View file

@ -265,8 +265,8 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac
}
}
if (!mPackages.empty())
{
assert(!mPackages.empty());
if (nearestDist < std::numeric_limits<float>::max() && mPackages.begin() != itActualCombat)
{
// move combat package with nearest target to the front
@ -275,7 +275,6 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac
package = mPackages.front();
}
}
try
{