mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 08:28:32 +01:00
Core/Threat: fix a potential super edge case iterator invalidation
This commit is contained in:
@@ -333,7 +333,9 @@ void ThreatManager::AddThreat(Unit* target, float amount, SpellInfo const* spell
|
|||||||
if (!redirInfo.empty())
|
if (!redirInfo.empty())
|
||||||
{
|
{
|
||||||
float const origAmount = amount;
|
float const origAmount = amount;
|
||||||
for (auto const& pair : redirInfo) // (victim,pct)
|
// intentional copy - there's a nested AddThreat call further down that might cause AI calls which cast spells
|
||||||
|
auto const redirects = redirInfo;
|
||||||
|
for (auto const& pair : redirects) // (victim,pct)
|
||||||
{
|
{
|
||||||
Unit* redirTarget = nullptr;
|
Unit* redirTarget = nullptr;
|
||||||
auto it = _myThreatListEntries.find(pair.first); // try to look it up in our threat list first (faster)
|
auto it = _myThreatListEntries.find(pair.first); // try to look it up in our threat list first (faster)
|
||||||
|
|||||||
Reference in New Issue
Block a user