From 88812ab9eed6b8e9babc3d9aac1cf13b5ee8750b Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Tue, 30 Oct 2012 12:50:08 +0200 Subject: Avoid NPE if CustomComponent has no child (#9895) Change-Id: I020951fb4490b09f5026b9d75de95d1661399e93 --- .../client/ui/customcomponent/CustomComponentConnector.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'client/src/com') diff --git a/client/src/com/vaadin/client/ui/customcomponent/CustomComponentConnector.java b/client/src/com/vaadin/client/ui/customcomponent/CustomComponentConnector.java index d14337afe4..09c90b3577 100644 --- a/client/src/com/vaadin/client/ui/customcomponent/CustomComponentConnector.java +++ b/client/src/com/vaadin/client/ui/customcomponent/CustomComponentConnector.java @@ -38,13 +38,13 @@ public class CustomComponentConnector extends @Override public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { - ComponentConnector newChild = null; + VCustomComponent customComponent = getWidget(); if (getChildComponents().size() == 1) { - newChild = getChildComponents().get(0); + ComponentConnector newChild = getChildComponents().get(0); + customComponent.setWidget(newChild.getWidget()); + } else { + customComponent.setWidget(null); } - VCustomComponent customComponent = getWidget(); - customComponent.setWidget(newChild.getWidget()); - } } -- cgit v1.2.3