From 93945062a734d3a4fcccecfe3206f7b39bf133a3 Mon Sep 17 00:00:00 2001 From: Hediadyoin1 Date: Tue, 21 Feb 2023 11:27:29 +0100 Subject: [PATCH] AK: Update HashTables head and tail when shifting during deletion Otherwise we end up with invalid pointers to them, breaking iteration. --- AK/HashTable.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/AK/HashTable.h b/AK/HashTable.h index 577dce85992..e57d83146de 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; } };