From e1931684c82b7bb8d794cd43c0abd2c95cf6b5ac Mon Sep 17 00:00:00 2001 From: Steve Hannah Date: Thu, 25 May 2017 09:08:03 -0700 Subject: [PATCH] Fixed NPE on iOS date picker when date set to null. https://groups.google.com/d/msg/codenameone-discussions/b_yxwYyohw4/KoiTTFK3BAAJ --- .../iOSPort/src/com/codename1/impl/ios/IOSImplementation.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Ports/iOSPort/src/com/codename1/impl/ios/IOSImplementation.java b/Ports/iOSPort/src/com/codename1/impl/ios/IOSImplementation.java index 8a8f4decc0..084d88478e 100644 --- a/Ports/iOSPort/src/com/codename1/impl/ios/IOSImplementation.java +++ b/Ports/iOSPort/src/com/codename1/impl/ios/IOSImplementation.java @@ -7620,8 +7620,10 @@ public Object showNativePicker(final int type, final Component source, final Obj c.set(java.util.Calendar.HOUR_OF_DAY, ((Integer)currentValue).intValue() / 60); c.set(java.util.Calendar.MINUTE, ((Integer)currentValue).intValue() % 60); time = c.getTime().getTime(); - } else { + } else if (currentValue != null) { time = ((java.util.Date)currentValue).getTime(); + } else { + time = new java.util.Date().getTime(); } nativeInstance.openDatePicker(type, time, x, y, w, h, preferredWidth, preferredHeight); }