From 6e67de21602e2a33ff0420e83d914a7da61e27a3 Mon Sep 17 00:00:00 2001 From: Greg Woolsey Date: Thu, 28 Dec 2017 08:17:33 +0000 Subject: [PATCH] Added a couple missing null checks. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1819398 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/ss/formula/OperationEvaluatorFactory.java | 2 +- src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/java/org/apache/poi/ss/formula/OperationEvaluatorFactory.java b/src/java/org/apache/poi/ss/formula/OperationEvaluatorFactory.java index 0f171d4e99..c1ce05c1bb 100644 --- a/src/java/org/apache/poi/ss/formula/OperationEvaluatorFactory.java +++ b/src/java/org/apache/poi/ss/formula/OperationEvaluatorFactory.java @@ -120,7 +120,7 @@ final class OperationEvaluatorFactory { EvaluationSheet evalSheet = ec.getWorkbook().getSheet(ec.getSheetIndex()); EvaluationCell evalCell = evalSheet.getCell(ec.getRowIndex(), ec.getColumnIndex()); - if ((evalCell.isPartOfArrayFormulaGroup() || ec.isInArrayContext()) && result instanceof ArrayFunction) + if (evalCell != null && (evalCell.isPartOfArrayFormulaGroup() || ec.isInArrayContext()) && result instanceof ArrayFunction) return ((ArrayFunction) result).evaluateArray(args, ec.getRowIndex(), ec.getColumnIndex()); return result.evaluate(args, ec.getRowIndex(), (short) ec.getColumnIndex()); diff --git a/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java b/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java index 7ba8f614e6..ec7f721d3c 100644 --- a/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java +++ b/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java @@ -597,7 +597,7 @@ public final class WorkbookEvaluator { EvaluationSheet evalSheet = ec.getWorkbook().getSheet(ec.getSheetIndex()); EvaluationCell evalCell = evalSheet.getCell(ec.getRowIndex(), ec.getColumnIndex()); - if (evalCell.isPartOfArrayFormulaGroup() && evaluationResult instanceof AreaEval) { + if (evalCell != null && evalCell.isPartOfArrayFormulaGroup() && evaluationResult instanceof AreaEval) { value = OperandResolver.getElementFromArray((AreaEval) evaluationResult, evalCell); } else {