aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGreg Woolsey <gwoolsey@apache.org>2019-03-16 06:55:16 +0000
committerGreg Woolsey <gwoolsey@apache.org>2019-03-16 06:55:16 +0000
commitee83ce5fcd19ae18713bfbcf9d6f508aff466eeb (patch)
tree271e9cb03d320ef33f433f1ee43b4172c04aa20f /src
parent8225326b568a9ddf79978c63c7a10dbeae1626b2 (diff)
downloadpoi-ee83ce5fcd19ae18713bfbcf9d6f508aff466eeb.tar.gz
poi-ee83ce5fcd19ae18713bfbcf9d6f508aff466eeb.zip
Handle possible invalid date value (#61652)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1855627 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/poi/ss/formula/functions/EDate.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/java/org/apache/poi/ss/formula/functions/EDate.java b/src/java/org/apache/poi/ss/formula/functions/EDate.java
index d4998b84b4..3faec3dd84 100644
--- a/src/java/org/apache/poi/ss/formula/functions/EDate.java
+++ b/src/java/org/apache/poi/ss/formula/functions/EDate.java
@@ -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);