Browse Source

Add null checks around accessibility host elements

fix/avnview-hittest
Timothy Miller 6 months ago
parent
commit
b5c8beb7c7
  1. 5
      native/Avalonia.Native/src/OSX/AvnView.mm
  2. 2
      native/Avalonia.Native/src/OSX/AvnWindow.mm

5
native/Avalonia.Native/src/OSX/AvnView.mm

@ -943,7 +943,7 @@ static void ConvertTilt(NSPoint tilt, float* xTilt, float* yTilt)
auto window = (AvnWindow*)[self window];
auto peer = [window automationPeer];
if (!peer->IsRootProvider())
if (!peer || !peer->IsRootProvider())
return nil;
auto clientPoint = [window convertPointFromScreen:point];
@ -980,6 +980,9 @@ static void ConvertTilt(NSPoint tilt, float* xTilt, float* yTilt)
// of the AvnView.
auto window = (AvnWindow*)[self window];
auto peer = [window automationPeer];
if (!peer)
return;
auto childPeers = peer->GetChildren();
auto childCount = childPeers != nullptr ? childPeers->GetCount() : 0;

2
native/Avalonia.Native/src/OSX/AvnWindow.mm

@ -619,7 +619,7 @@
- (IAvnAutomationPeer* _Nonnull) automationPeer
{
auto parent = _parent.tryGet();
if (_automationPeer == nullptr)
if (_automationPeer == nullptr && parent != nullptr)
{
_automationPeer = parent->BaseEvents->GetAutomationPeer();
_automationNode = new AvnAutomationNode(self);

Loading…
Cancel
Save