summaryrefslogtreecommitdiff
path: root/src/mongo/base/dependency_graph.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/base/dependency_graph.cpp')
-rw-r--r--src/mongo/base/dependency_graph.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mongo/base/dependency_graph.cpp b/src/mongo/base/dependency_graph.cpp
index 8d9107b5a10..612fcbc7d3d 100644
--- a/src/mongo/base/dependency_graph.cpp
+++ b/src/mongo/base/dependency_graph.cpp
@@ -105,6 +105,9 @@ std::vector<std::string> DependencyGraph::topSort(std::vector<std::string>* cycl
// Swap the pointers in the `elements` vector that point to `a` and `b`.
// Update their 'membership' data members to reflect the change.
auto swapPositions = [](Element& a, Element& b) {
+ if (&a == &b) {
+ return;
+ }
using std::swap;
swap(*a.membership, *b.membership);
swap(a.membership, b.membership);