Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avalonia.Input.InputExtensions.GetInputElementsAt throws System.NullReferenceException' #2854

Closed
wieslawsoltes opened this issue Aug 16, 2019 · 1 comment

Comments

@wieslawsoltes
Copy link
Contributor

Exception thrown: 'System.NullReferenceException' in Avalonia.Visuals.dll
Object reference not set to an instance of an object.
   at Avalonia.VisualTree.VisualExtensions.GetVisualsAt(IVisual visual, Point p, Func`2 filter)
   at Avalonia.Input.InputExtensions.GetInputElementsAt(IInputElement element, Point p)
   at Dock.Avalonia.Controls.DockState.GetControl(IInputElement input, Point point, AvaloniaProperty`1 property) in C:\DOWNLOADS\GitHub\Dock\src\Dock.Avalonia\Controls\Docking\DockState.cs:line 142

Version: 0.8.999-cibuild0003548-beta

@wieslawsoltes
Copy link
Contributor Author

return element.GetVisualsAt(p, IsHitTestVisible).Cast<IInputElement>();

This should check for null?

return element.GetVisualsAt(p, IsHitTestVisible)?.Cast<IInputElement>();

return element.GetInputElementsAt(p).FirstOrDefault();

This should check for null?

return element.GetInputElementsAt(p)?.FirstOrDefault();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant