]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed NPE when layout is empty
authorArtur Signell <artur@vaadin.com>
Thu, 15 Mar 2012 10:57:48 +0000 (12:57 +0200)
committerArtur Signell <artur@vaadin.com>
Thu, 15 Mar 2012 10:57:48 +0000 (12:57 +0200)
src/com/vaadin/terminal/gwt/client/ui/AbstractOrderedLayoutConnector.java

index 619eb8d9802a2ec1831761e381841d82866ba32e..cd791fba081bc6242f65d2767e9c896834855ffc 100644 (file)
@@ -110,20 +110,23 @@ public abstract class AbstractOrderedLayoutConnector extends
             previousChildren.remove(child);
         }
 
-        for (ComponentConnector child : previousChildren) {
-            Widget widget = child.getWidget();
-
-            // Don't remove and unregister if it has been moved to a different
-            // parent. Slot element will be left behind, but that is taken care
-            // of later
-            if (widget.getParent() == getWidget()) {
-                layout.removeSlot(layout.getSlotForChild(widget));
-
-                ConnectorMap vPaintableMap = ConnectorMap.get(client);
-                vPaintableMap.unregisterConnector(child);
+        if (previousChildren != null) {
+            for (ComponentConnector child : previousChildren) {
+                Widget widget = child.getWidget();
+
+                // Don't remove and unregister if it has been moved to a
+                // different
+                // parent. Slot element will be left behind, but that is taken
+                // care
+                // of later
+                if (widget.getParent() == getWidget()) {
+                    layout.removeSlot(layout.getSlotForChild(widget));
+
+                    ConnectorMap vPaintableMap = ConnectorMap.get(client);
+                    vPaintableMap.unregisterConnector(child);
+                }
             }
         }
-
         // Remove empty layout slots left behind after children have moved to
         // other paintables
         while (true) {