From 9ec0836da938a10dd0730760848abf5b788e943c Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 23 May 2023 21:29:05 +0100 Subject: [PATCH] Put the capacity check back in --- agb-hashmap/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/agb-hashmap/src/lib.rs b/agb-hashmap/src/lib.rs index cf224910..a4d6cb08 100644 --- a/agb-hashmap/src/lib.rs +++ b/agb-hashmap/src/lib.rs @@ -339,6 +339,10 @@ where } unsafe fn insert_new_and_get(&mut self, key: K, value: V, hash: HashType) -> &'_ mut V { + if self.nodes.capacity() <= self.len() { + self.resize(self.nodes.backing_vec_size() * 2); + } + let location = self.nodes.insert_new(key, value, hash); // SAFETY: location is always valid