Skip to content

Commit 06c7a0e

Browse files
committed
Set the bytes to null after is has been disposed to allow multiple calls to dispose.
1 parent 8508463 commit 06c7a0e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Shared/PooledByteArray.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@ public int Length
2424
=> _bytes.Length;
2525

2626
public void Dispose()
27-
=> _pool.Return(_bytes);
27+
{
28+
if (_bytes == null)
29+
return;
30+
31+
_pool.Return(_bytes);
32+
_bytes = null!;
33+
}
2834

2935
public void Resize(int length)
3036
{

0 commit comments

Comments
 (0)