Skip to content

Commit

Permalink
only one IndexOf in ListView.UnhookContent
Browse files Browse the repository at this point in the history
  • Loading branch information
trivalik committed Jan 12, 2023
1 parent 3bae700 commit fe812f8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Controls/src/Core/ListView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,12 @@ protected override void UnhookContent(Cell content)
{
base.UnhookContent(content);

if (content == null || !_logicalChildren.Contains(content))
if (content == null)
return;
var index = _logicalChildren.IndexOf(content);
_logicalChildren.Remove(content);
if (index == -1)
return;
_logicalChildren.RemoveAt(index);
content.Parent = null;
VisualDiagnostics.OnChildRemoved(this, content, index);

Expand Down

0 comments on commit fe812f8

Please sign in to comment.