fix: Fixes pooled ref collections dispose on defaults (#1638)

This commit is contained in:
Stefano Merotta 2023-12-15 22:46:52 +01:00 committed by GitHub
parent 0d65464c9f
commit 1ab367d637
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -1143,7 +1143,7 @@ public ref struct PooledRefList<T>
{
var array = _items;
if (array.Length > 0)
if (array?.Length > 0)
{
Clear();
ArrayPool.Return(_items);

View file

@ -385,7 +385,7 @@ public ref struct PooledRefQueue<T>
public void Dispose()
{
var array = _array;
if (array.Length > 0)
if (array?.Length > 0)
{
Clear();
(_mt ? ArrayPool<T>.Shared : STArrayPool<T>.Shared).Return(array);