From 3dcd49ef9015582be304e2521e13052c68b917d6 Mon Sep 17 00:00:00 2001 From: Treeston Date: Tue, 9 Jan 2018 23:42:22 +0100 Subject: Core/Threat: fix a potential super edge case iterator invalidation --- src/server/game/Combat/ThreatManager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 3c71fc9acff..b7f1aec9854 100644 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -333,7 +333,9 @@ void ThreatManager::AddThreat(Unit* target, float amount, SpellInfo const* spell if (!redirInfo.empty()) { 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; auto it = _myThreatListEntries.find(pair.first); // try to look it up in our threat list first (faster) -- cgit v1.2.3