Core/Loot: Fixed iterator invalidation crash in WorldSession::HandleLootMoneyOpcode

Port From (https://github.com/TrinityCore/TrinityCore/commit/81cf682cfe0ba30931f9588f83e1e072325defce)
This commit is contained in:
hondacrx
2023-04-21 18:28:14 -04:00
parent 19c484dc5a
commit cffa1fe172
+5 -1
View File
@@ -86,6 +86,7 @@ namespace Game
void HandleLootMoney(LootMoney lootMoney)
{
Player player = GetPlayer();
List<Loot> forceLootRelease = new();
foreach (var lootView in player.GetAELootView())
{
@@ -150,8 +151,11 @@ namespace Game
// Delete container if empty
if (loot.IsLooted() && guid.IsItem())
player.GetSession().DoLootRelease(loot);
forceLootRelease.Add(loot);
}
foreach (Loot loot in forceLootRelease)
player.GetSession().DoLootRelease(loot);
}
class AELootCreatureCheck : ICheck<Creature>