mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-01 02:45:32 +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:
parent
b168544445
commit
e3cce0949e
1 changed files with 7 additions and 8 deletions
|
@ -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)
|
if (nearestDist < std::numeric_limits<float>::max() && mPackages.begin() != itActualCombat)
|
||||||
{
|
{
|
||||||
// move combat package with nearest target to the front
|
// 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();
|
package = mPackages.front();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue