Common/Containers: Eliminate a edge case that could potentially lead to object invalidation.

(cherry picked from commit 64a61e03ab0799b5437ddb9fe702c4912f3f9dd9)
This commit is contained in:
Treeston
2021-10-15 00:10:10 +02:00
committed by Shauren
parent b638f37788
commit 839d30e93b
+2 -1
View File
@@ -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;
}