Browse Source

Check for null visual parent. (#7298)

It shouldn't be possible to come across a null visual parent here because the visual should be attached to the visual tree, but according to #6930, it is. Because we don't have a repro here, defensively return a null value instead of throwing if we hit this case.
pull/7310/head
Steven Kirk 5 years ago
committed by GitHub
parent
commit
a175fbbe3a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/Avalonia.Visuals/Rendering/SceneGraph/SceneBuilder.cs

7
src/Avalonia.Visuals/Rendering/SceneGraph/SceneBuilder.cs

@ -126,7 +126,12 @@ namespace Avalonia.Rendering.SceneGraph
while (node == null && visual.IsVisible)
{
visual = visual.VisualParent!;
var parent = visual.VisualParent;
if (parent is null)
return null;
visual = parent;
node = scene.FindNode(visual);
}

Loading…
Cancel
Save