Added a couple missing null checks.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1819398 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Greg Woolsey 2017-12-28 08:17:33 +00:00
parent 94bec76385
commit 6e67de2160
2 changed files with 2 additions and 2 deletions

View File

@ -120,7 +120,7 @@ final class OperationEvaluatorFactory {
EvaluationSheet evalSheet = ec.getWorkbook().getSheet(ec.getSheetIndex()); EvaluationSheet evalSheet = ec.getWorkbook().getSheet(ec.getSheetIndex());
EvaluationCell evalCell = evalSheet.getCell(ec.getRowIndex(), ec.getColumnIndex()); 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 ((ArrayFunction) result).evaluateArray(args, ec.getRowIndex(), ec.getColumnIndex());
return result.evaluate(args, ec.getRowIndex(), (short) ec.getColumnIndex()); return result.evaluate(args, ec.getRowIndex(), (short) ec.getColumnIndex());

View File

@ -597,7 +597,7 @@ public final class WorkbookEvaluator {
EvaluationSheet evalSheet = ec.getWorkbook().getSheet(ec.getSheetIndex()); EvaluationSheet evalSheet = ec.getWorkbook().getSheet(ec.getSheetIndex());
EvaluationCell evalCell = evalSheet.getCell(ec.getRowIndex(), ec.getColumnIndex()); 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); value = OperandResolver.getElementFromArray((AreaEval) evaluationResult, evalCell);
} }
else { else {