]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix NPE in fix (#12504)
authorArtur Signell <artur@vaadin.com>
Mon, 4 Nov 2013 17:59:50 +0000 (19:59 +0200)
committerArtur Signell <artur@vaadin.com>
Mon, 4 Nov 2013 18:00:02 +0000 (20:00 +0200)
Change-Id: I65960bcfae850955ea40584445125c0affa26848

client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java

index a82bfd1391ad55bc08d2de8209858ef7b5d87f09..d2aadca99bd218eb3541c53611e788b5d3246fd6 100644 (file)
@@ -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