From e82d67f66454bde076a1250009f17a2ad0fb54c9 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sun, 28 Jul 2019 19:30:07 +0200 Subject: [PATCH] Prevent NRE in VisualNode.HitTest. Not sure how this is happening but judging by #2758, it can happen. Defensively check for a null `Item` to prevent this. Fixes #2758. --- src/Avalonia.Visuals/Rendering/SceneGraph/VisualNode.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/VisualNode.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/VisualNode.cs index 4e95d21a48..12cfc7cbe3 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/VisualNode.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/VisualNode.cs @@ -236,7 +236,7 @@ namespace Avalonia.Rendering.SceneGraph { foreach (var operation in DrawOperations) { - if (operation.Item.HitTest(p)) + if (operation?.Item?.HitTest(p) == true) { return true; }