mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-20 15:01:38 -04:00
Common/Containers: Eliminate a edge case that could potentially lead to object invalidation.
(cherry picked from commit 64a61e03ab)
This commit is contained in:
@@ -68,7 +68,8 @@ namespace Trinity
|
||||
// this element has chance (elementsToKeep / elementsToProcess) of being kept
|
||||
if (urand(1, elementsToProcess) <= elementsToKeep)
|
||||
{
|
||||
*keepIt = std::move(*curIt);
|
||||
if (keepIt != curIt)
|
||||
*keepIt = std::move(*curIt);
|
||||
++keepIt;
|
||||
--elementsToKeep;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user