From f7b2d4047f2305917c20ef0537a9c3df4d1a4540 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Thu, 10 Jan 2013 15:08:22 +0000 Subject: Patch from Johan from bug #54402 - fix IfError with indirect references git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1431403 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/poi/ss/formula/atp/IfError.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/java') diff --git a/src/java/org/apache/poi/ss/formula/atp/IfError.java b/src/java/org/apache/poi/ss/formula/atp/IfError.java index 5b7e21b8d0..d3a22661b8 100644 --- a/src/java/org/apache/poi/ss/formula/atp/IfError.java +++ b/src/java/org/apache/poi/ss/formula/atp/IfError.java @@ -18,6 +18,7 @@ package org.apache.poi.ss.formula.atp; import org.apache.poi.ss.formula.OperationEvaluationContext; +import org.apache.poi.ss.formula.WorkbookEvaluator; import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.ss.formula.eval.EvaluationException; import org.apache.poi.ss.formula.eval.ValueEval; @@ -47,7 +48,7 @@ final class IfError implements FreeRefFunction { ValueEval val; try { - val = evaluateArgParity(args[0], args[1], ec.getRowIndex(), ec.getColumnIndex()); + val = evaluateInternal(args[0], args[1], ec.getRowIndex(), ec.getColumnIndex()); } catch (EvaluationException e) { return e.getErrorEval(); } @@ -55,11 +56,12 @@ final class IfError implements FreeRefFunction { return val; } - private static ValueEval evaluateArgParity(ValueEval arg, ValueEval iferror, int srcCellRow, int srcCellCol) throws EvaluationException { + private static ValueEval evaluateInternal(ValueEval arg, ValueEval iferror, int srcCellRow, int srcCellCol) throws EvaluationException { + arg = WorkbookEvaluator.dereferenceResult(arg, srcCellRow, srcCellCol); if(arg instanceof ErrorEval) { return iferror; } else { return arg; } } -} \ No newline at end of file +} -- cgit v1.2.3