fix: Fixes pooled ref collections dispose on defaults (#1638)
This commit is contained in:
parent
0d65464c9f
commit
1ab367d637
2 changed files with 2 additions and 2 deletions
|
|
@ -1143,7 +1143,7 @@ public ref struct PooledRefList<T>
|
|||
{
|
||||
var array = _items;
|
||||
|
||||
if (array.Length > 0)
|
||||
if (array?.Length > 0)
|
||||
{
|
||||
Clear();
|
||||
ArrayPool.Return(_items);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue