From 8e86543ddeb22d2ffef530d513e7fab2c81fbaef Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Tue, 26 Feb 2019 09:03:12 +0000 Subject: [PATCH] fpspreadsheet: Fix formula parser ignoring errors in binary nodes (see https://forum.lazarus.freepascal.org/index.php/topic,44426.0.html) git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6819 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../source/common/fpsexprparser.pas | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/components/fpspreadsheet/source/common/fpsexprparser.pas b/components/fpspreadsheet/source/common/fpsexprparser.pas index d7ee6a056..82ad92101 100644 --- a/components/fpspreadsheet/source/common/fpsexprparser.pas +++ b/components/fpspreadsheet/source/common/fpsexprparser.pas @@ -3531,9 +3531,10 @@ var LRes, RRes: TsExpressionResult; fL, fR: TsExprFloat; begin + { if HasError(AResult) then exit; - + } Left.GetNodeValue(LRes); Right.GetNodeValue(RRes); @@ -3567,9 +3568,10 @@ var lRes, RRes: TsExpressionResult; fL, fR: TsExprFloat; begin + { if HasError(AResult) then exit; - + } Left.GetNodeValue(LRes); Right.GetNodeValue(RRes); @@ -3603,9 +3605,10 @@ var LRes, RRes: TsExpressionResult; fL, fR: TsExprFloat; begin + { if HasError(AResult) then exit; - + } Left.GetNodeValue(LRes); Right.GetNodeValue(RRes); fL := ArgToFloat(LRes); @@ -3642,9 +3645,10 @@ var LRes, RRes: TsExpressionResult; fL, fR: TsExprFloat; begin + { if HasError(AResult) then exit; - + } Left.GetNodeValue(LRes); Right.GetNodeValue(RRes); @@ -3690,9 +3694,10 @@ var LRes, RRes: TsExpressionResult; fL, fR: TsExprFloat; begin + { if HasError(AResult) then exit; - + } Left.GetNodeValue(LRes); Right.GetNodeValue(RRes); fL := ArgToFloat(LRes); @@ -4469,6 +4474,7 @@ begin rtBoolean : if Arg.ResBoolean then Result := 1.0; rtString, rtHyperlink : TryStrToFloat(ArgToString(Arg), Result); + rtError : Result := NaN; rtCell : begin cell := ArgToCell(Arg); if Assigned(cell) then @@ -4486,8 +4492,10 @@ begin if not TryStrToFloat(s, Result, fs) then Result := NaN; end; + cctError: + Result := NaN; end; - end; + end; end; end;