Skip to content

Commit

Permalink
fix error CS8618: Non-nullable field '_children'
Browse files Browse the repository at this point in the history
  • Loading branch information
Epica3055 committed Apr 28, 2024
1 parent c16015c commit c03c48b
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ internal TreeNodeImageIndexer StateImageIndexer

internal int _index; // our index into our parents child array
internal int _childCount;
internal TreeNode[] _children;
internal TreeNode[] _children = [];
internal TreeNode? _parent;
internal TreeView? _treeView;
private bool _expandOnRealization;
Expand Down Expand Up @@ -1315,7 +1315,7 @@ internal void Clear()
_children[^1].Remove(true);
}

_children = null;
_children = [];

if (tv is not null && isBulkOperation)
{
Expand Down Expand Up @@ -1602,7 +1602,7 @@ internal void EnsureCapacity(int num)
size = 4;
}

if (_children is null)
if (_children is null || _children.Length == 0)
{
_children = new TreeNode[size];
}
Expand Down

0 comments on commit c03c48b

Please sign in to comment.