diff options
author | Treeston <treeston.mmoc@gmail.com> | 2018-07-19 11:59:36 +0200 |
---|---|---|
committer | Treeston <treeston.mmoc@gmail.com> | 2018-07-19 11:59:36 +0200 |
commit | 64a61e03ab0799b5437ddb9fe702c4912f3f9dd9 (patch) | |
tree | d1584a4208523b1b7cf7dfbcbe5315fd3d03736c /src | |
parent | c37cd258bd8ea6a5245fbd81757d1b0328914dcc (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.h | 3 |
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; } |