From fa1f5bc8f9f5e3b91b6a97801910d79e6af41cc5 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 13 Jul 2017 15:11:48 +0100 Subject: [PATCH] add fix for null reference exception when arranging. added comments explaining the conditions that the bug occurs in. --- src/Avalonia.Layout/LayoutManager.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Layout/LayoutManager.cs b/src/Avalonia.Layout/LayoutManager.cs index 965ab3eee6..1ce55e2afa 100644 --- a/src/Avalonia.Layout/LayoutManager.cs +++ b/src/Avalonia.Layout/LayoutManager.cs @@ -190,8 +190,10 @@ namespace Avalonia.Layout { root.Arrange(new Rect(control.DesiredSize)); } - else + else if(control.PreviousArrange != null) { + // Has been observed that PreviousArrange sometimes is null, probably a bug somewhere else. + // Condition observed: control.VisualParent is Scrollbar, control is Border. control.Arrange(control.PreviousArrange.Value); } }