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
Notes:
sideshowbarker
2024-07-18 04:03:35 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/913382734c7 Pull-request: https://github.com/SerenityOS/serenity/pull/9976
1 changed files with 2 additions and 0 deletions
|
@ -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)));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue