]> source.dussan.org Git - poi.git/commitdiff
Handle possible invalid date value (#61652)
authorGreg Woolsey <gwoolsey@apache.org>
Sat, 16 Mar 2019 06:55:16 +0000 (06:55 +0000)
committerGreg Woolsey <gwoolsey@apache.org>
Sat, 16 Mar 2019 06:55:16 +0000 (06:55 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1855627 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/ss/formula/functions/EDate.java

index d4998b84b40646b4469b140944d4dd7aeeee9584..3faec3dd84bce83ccccf8f2f9f1f056778011e17 100644 (file)
@@ -45,6 +45,9 @@ public class EDate implements FreeRefFunction {
             int offsetInMonthAsNumber = (int) getValue(args[1]);
 
             Date startDate = DateUtil.getJavaDate(startDateAsNumber);
+            if (startDate == null) {
+                return ErrorEval.VALUE_INVALID;
+            }
             Calendar calendar = LocaleUtil.getLocaleCalendar();
             calendar.setTime(startDate);
             calendar.add(Calendar.MONTH, offsetInMonthAsNumber);