From: Artur Signell Date: Thu, 15 Mar 2012 10:57:48 +0000 (+0200) Subject: Fixed NPE when layout is empty X-Git-Tag: 7.0.0.alpha2~318 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=61d84cda1918c0a0874e4a9e290a418aba391c5b;p=vaadin-framework.git Fixed NPE when layout is empty --- diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractOrderedLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractOrderedLayoutConnector.java index 619eb8d980..cd791fba08 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/AbstractOrderedLayoutConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/AbstractOrderedLayoutConnector.java @@ -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) {