aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTreeston <treeston.mmoc@gmail.com>2018-07-19 11:59:36 +0200
committerTreeston <treeston.mmoc@gmail.com>2018-07-19 11:59:36 +0200
commit64a61e03ab0799b5437ddb9fe702c4912f3f9dd9 (patch)
treed1584a4208523b1b7cf7dfbcbe5315fd3d03736c /src
parentc37cd258bd8ea6a5245fbd81757d1b0328914dcc (diff)
Common/Containers: Eliminate a edge case that could potentially lead to object invalidation.
Diffstat (limited to 'src')
-rw-r--r--src/common/Utilities/Containers.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/Utilities/Containers.h b/src/common/Utilities/Containers.h
index e45bfa5cdbc..c43012e6d73 100644
--- a/src/common/Utilities/Containers.h
+++ b/src/common/Utilities/Containers.h
@@ -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;
}