mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 14:07:45 +00:00
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:
parent
27e3589f61
commit
913382734c
1 changed files with 2 additions and 0 deletions
|
@ -486,6 +486,8 @@ public:
|
||||||
ConstIterator find_largest_not_above_iterator(K key) const
|
ConstIterator find_largest_not_above_iterator(K key) const
|
||||||
{
|
{
|
||||||
auto node = static_cast<Node*>(BaseTree::find_largest_not_above(this->m_root, key));
|
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)));
|
return ConstIterator(node, static_cast<Node*>(BaseTree::predecessor(node)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue