Skip to content

Commit

Permalink
Check for null ItemsView.
Browse files Browse the repository at this point in the history
  • Loading branch information
grokys committed Jul 2, 2024
1 parent a0da097 commit bef5d7d
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,18 @@ public T? this[int index]

private IEnumerable<T?> EnumerateNode(TreeSelectionNode<T> node)
{
foreach (var range in node.Ranges)
if (node.ItemsView is not null)
{
for (var i = range.Begin; i <= range.End; ++i)
foreach (var range in node.Ranges)
{
yield return node.ItemsView![i];
for (var i = range.Begin; i <= range.End; ++i)
{
yield return node.ItemsView[i];
}
}
}

if (node.Children is object)
if (node.Children is not null)
{
foreach (var child in node.Children)
{
Expand Down Expand Up @@ -110,4 +113,4 @@ public TreeSelectedItems(TreeSelectionModelBase<T> root) : base(root) { }
yield return i;
}
}
}
}

0 comments on commit bef5d7d

Please sign in to comment.