Skip to content

Commit

Permalink
Fix crash in ItemsRepeater_ViewportManager
Browse files Browse the repository at this point in the history
  • Loading branch information
amwx committed Jun 22, 2024
1 parent 5a75395 commit 5b14b42
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/FluentAvalonia/UI/Controls/Repeater/ViewportManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,17 @@ private Control GetImmediateChildOfRepeater(Control descendant)
parent = (Control)parent.GetVisualParent();
}

// This is what WinUI does, but this can be hit in Avalonia...
// My repro: ItemsRepeater -> Control w/ Popup -> ListBox in Popup
// Select item in the ListBox, we hit this
// Looking at Avalonia's port of ItemsRepeater, they just return
// null if parent is null, so that's what I'll do
//if (parent == null)
//{
// throw new InvalidOperationException("OnBringIntoViewRequested called with args.target element not under the ItemsRepeater that recieved the call");
//}
if (parent == null)
{
throw new InvalidOperationException("OnBringIntoViewRequested called with args.target element not under the ItemsRepeater that recieved the call");
}
return null;

return targetChild;
}
Expand Down

0 comments on commit 5b14b42

Please sign in to comment.