diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-09-13 01:46:33 +0430 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-09-13 14:38:53 +0430 |
commit | 913382734c7bcbeac1366c1197766b398974c031 (patch) | |
tree | efe8d94d12bce1e390641aec29b48777c25b771f /AK | |
parent | 27e3589f6112044213deacd676d855aea737d0d2 (diff) | |
download | serenity-913382734c7bcbeac1366c1197766b398974c031.zip |
AK: Allow RBTree::find_largest_not_above_iterator() to fail
Previously this function would've crashed if the key failed to match any
entry.
Diffstat (limited to 'AK')
-rw-r--r-- | AK/RedBlackTree.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/AK/RedBlackTree.h b/AK/RedBlackTree.h index adce1cc5f7..b9ae98adfe 100644 --- a/AK/RedBlackTree.h +++ b/AK/RedBlackTree.h @@ -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))); } |