Browse Source

add fix for null reference exception when arranging.

added comments explaining the conditions that the bug occurs in.
(cherry picked from commit fa1f5bc8f9f5e3b91b6a97801910d79e6af41cc5)
Dan Walmsley 8 years ago
parent
commit
71dff48a7a
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/Avalonia.Layout/LayoutManager.cs

+ 3 - 1
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);
                 }
             }