diff options
author | Hediadyoin1 <leon2002.la@gmail.com> | 2023-02-21 11:27:29 +0100 |
---|---|---|
committer | Jelle Raaijmakers <jelle@gmta.nl> | 2023-02-21 22:13:06 +0100 |
commit | 93945062a734d3a4fcccecfe3206f7b39bf133a3 (patch) | |
tree | d91eac4ad54325ef2668a1338dfec56d39c8d683 /AK | |
parent | 2ca8cf49ca84ea58f3de4a505e8a8d14f076b477 (diff) | |
download | serenity-93945062a734d3a4fcccecfe3206f7b39bf133a3.zip |
AK: Update HashTables head and tail when shifting during deletion
Otherwise we end up with invalid pointers to them, breaking iteration.
Diffstat (limited to 'AK')
-rw-r--r-- | AK/HashTable.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/AK/HashTable.h b/AK/HashTable.h index 577dce8599..e57d83146d 100644 --- a/AK/HashTable.h +++ b/AK/HashTable.h @@ -654,8 +654,12 @@ private: if constexpr (IsOrdered) { if (bucket->previous) bucket->previous->next = bucket; + else + m_collection_data.head = bucket; if (bucket->next) bucket->next->previous = bucket; + else + m_collection_data.tail = bucket; } }; |