RecyclableCollections.Contains(T item) fixes to exceptions found by tests.

This commit is contained in:
Marek Lemańczyk committed 2023-03-16 02:21:14 +01:00
1 parent ca6ee45bb6
commit c2eefdfe3b
1 file changed
+1 -1
+1 -1
View File
@@ -719,7 +719,7 @@ namespace Recyclable.Collections
}
}
return Array.IndexOf(memoryBlocksSpan[lastBlockIndex], item, 0, _nextItemIndex) >= 0;
return lastBlockIndex < memoryBlocksSpan.Length && Array.IndexOf(memoryBlocksSpan[lastBlockIndex], item, 0, _nextItemIndex) >= 0;
}
public void CopyTo(T[] array, int arrayIndex) => _memoryBlocks.CopyTo(0, _blockSize, _longCount, array, arrayIndex);