Skip to content

Commit

Permalink
fix: Fixes pooled ref collections dispose on defaults (#1638)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanomerotta authored Dec 15, 2023
1 parent 0d65464 commit 1ab367d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Projects/Server/Collections/PooledRefList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ public void Dispose()
{
var array = _items;

if (array.Length > 0)
if (array?.Length > 0)
{
Clear();
ArrayPool.Return(_items);
Expand Down
2 changes: 1 addition & 1 deletion Projects/Server/Collections/PooledRefQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ private void Grow(int capacity)
public void Dispose()
{
var array = _array;
if (array.Length > 0)
if (array?.Length > 0)
{
Clear();
(_mt ? ArrayPool<T>.Shared : STArrayPool<T>.Shared).Return(array);
Expand Down

0 comments on commit 1ab367d

Please sign in to comment.