AK: Allow RBTree::find_largest_not_above_iterator() to fail

Previously this function would've crashed if the key failed to match any
entry.
This commit is contained in:
Ali Mohammad Pur 2021-09-13 01:46:33 +04:30 committed by Ali Mohammad Pur
parent 27e3589f61
commit 913382734c

View file

@ -486,6 +486,8 @@ public:
ConstIterator find_largest_not_above_iterator(K key) const
{
auto node = static_cast<Node*>(BaseTree::find_largest_not_above(this->m_root, key));
if (!node)
return end();
return ConstIterator(node, static_cast<Node*>(BaseTree::predecessor(node)));
}