From: Artur Signell Date: Mon, 4 Nov 2013 17:59:50 +0000 (+0200) Subject: Fix NPE in fix (#12504) X-Git-Tag: 7.1.8~7 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c4aff7781269427bd4beccf7fc7d04b8760359b5;p=vaadin-framework.git Fix NPE in fix (#12504) Change-Id: I65960bcfae850955ea40584445125c0affa26848 --- diff --git a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java index a82bfd1391..d2aadca99b 100644 --- a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java +++ b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java @@ -178,8 +178,16 @@ public class PopupDateFieldConnector extends TextualDateConnector { public void onStateChanged(StateChangeEvent stateChangeEvent) { super.onStateChanged(stateChangeEvent); getWidget().setTextFieldEnabled(getState().textFieldEnabled); - getWidget().setRangeStart((Date) getState().rangeStart.clone()); - getWidget().setRangeEnd((Date) getState().rangeEnd.clone()); + getWidget().setRangeStart(nullSafeDateClone(getState().rangeStart)); + getWidget().setRangeEnd(nullSafeDateClone(getState().rangeEnd)); + } + + private Date nullSafeDateClone(Date date) { + if (date == null) { + return null; + } else { + return (Date) date.clone(); + } } @Override