From c4aff7781269427bd4beccf7fc7d04b8760359b5 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 4 Nov 2013 19:59:50 +0200 Subject: [PATCH] Fix NPE in fix (#12504) Change-Id: I65960bcfae850955ea40584445125c0affa26848 --- .../client/ui/datefield/PopupDateFieldConnector.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 -- 2.39.5