@@ -336,21 +336,24 @@ if (_buckets[i] != NULL && _buckets[i] != &deleted) { uint32_t j, last; last = capacity; - j = _buckets[i]->hash & (capacity - 1); - for (; j < last && buckets[j] != NULL; j++); + for (j = _buckets[i]->hash & (capacity - 1); + j < last && buckets[j] != NULL; j++); /* In case the last bucket is already used */ if (j >= last) { last = _buckets[i]->hash & (capacity - 1); for (j = 0; j < last && buckets[j] != NULL; j++); } + if (j >= last) + @throw [OFOutOfRangeException exception]; + buckets[j] = _buckets[i]; } } [self freeMemory: _buckets];