Browse Source

Handle detached controls in layout pass.

Controls can still be queued for layout after they've been removed from
the visual tree.
Steven Kirk 10 years ago
parent
commit
b72f08354a
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/Perspex.Layout/LayoutManager.cs

+ 2 - 2
src/Perspex.Layout/LayoutManager.cs

@@ -276,12 +276,12 @@ namespace Perspex.Layout
                         {
                             var control = item.Control;
 
-                            while (control.PreviousArrange == null)
+                            while (control != null && control.PreviousArrange == null)
                             {
                                 control = control.GetVisualParent<ILayoutable>();
                             }
 
-                            if (control.GetVisualRoot() == Root)
+                            if (control != null && control.GetVisualRoot() == Root)
                             {
                                 control.Arrange(control.PreviousArrange.Value, true);
                             }