@@ -408,14 +408,14 @@ class HashSetBase
408408 }
409409else
410410 {
411- const int32 elementsCount = _elementsCount;
412411// Rebuild entire table completely
412+ const int32 elementsCount = _elementsCount;
413413const int32 oldSize = _size;
414414 AllocationData oldAllocation;
415415 AllocationUtils::MoveToEmpty<BucketType, AllocationType>(oldAllocation, _allocation, oldSize, oldSize);
416416 _allocation.Allocate (_size);
417417 BucketType* data = _allocation.Get ();
418- for (int32 i =0 ; i <_size ; ++i)
418+ for (int32 i =0 ; i <oldSize ; ++i)
419419 data[i]._state = HashSetBucketState::Empty;
420420 BucketType* oldData = oldAllocation.Get ();
421421 FindPositionResult pos;
@@ -430,8 +430,8 @@ class HashSetBase
430430// Grow and retry to handle pathological cases (eg. heavy collisions)
431431EnsureCapacity (_size +1 ,true );
432432FindPosition (oldBucket.GetKey (), pos);
433+ ASSERT (pos.FreeSlotIndex != -1 );
433434 }
434- ASSERT (pos.FreeSlotIndex != -1 );
435435 BucketType& bucket = _allocation.Get ()[pos.FreeSlotIndex ];
436436 bucket =MoveTemp (oldBucket);
437437 }