diff options
Diffstat (limited to 'src/mongo/db/sorter/sorter.cpp')
-rw-r--r-- | src/mongo/db/sorter/sorter.cpp | 2 |
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. |