diff --git a/AK/HashTable.h b/AK/HashTable.h index 0bb6bda7ef6..1ae17b6b628 100644 --- a/AK/HashTable.h +++ b/AK/HashTable.h @@ -244,8 +244,10 @@ void HashTable::set(T&& value) rehash(1); auto& bucket = lookup(value); for (auto& e : bucket.chain) { - if (e == value) + if (e == value) { + e = move(value); return; + } } if (size() >= capacity()) { rehash(size() + 1); @@ -263,8 +265,10 @@ void HashTable::set(const T& value) rehash(1); auto& bucket = lookup(value); for (auto& e : bucket.chain) { - if (e == value) + if (e == value) { + e = move(value); return; + } } if (size() >= capacity()) { rehash(size() + 1);