summaryrefslogtreecommitdiff
path: root/src/mongo/db/sorter/sorter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/sorter/sorter.cpp')
-rw-r--r--src/mongo/db/sorter/sorter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mongo/db/sorter/sorter.cpp b/src/mongo/db/sorter/sorter.cpp
index 7174d893f9d..e520d6d4c23 100644
--- a/src/mongo/db/sorter/sorter.cpp
+++ b/src/mongo/db/sorter/sorter.cpp
@@ -1402,7 +1402,7 @@ BoundedSorter<Key, Value, Comparator, BoundMaker>::getState() const {
// _heap.top() is the min of _heap, but we also need to consider whether a smaller input
// will arrive later. So _heap.top() is safe to return only if _heap.top() < _min.
- if (compare(_heap.top().first, *_min) < 0)
+ if (!_heap.empty() && compare(_heap.top().first, *_min) < 0)
return State::kReady;
// Similarly, we can return the next element from the spilled iterator if it's < _min.