From 61d84cda1918c0a0874e4a9e290a418aba391c5b Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 15 Mar 2012 12:57:48 +0200 Subject: [PATCH] Fixed NPE when layout is empty --- .../ui/AbstractOrderedLayoutConnector.java | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) 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) { -- 2.39.5