You've already forked lazarus-ccr
fpspreadsheet: Fix ods reader crashing if a formula contains an error cell reference like #REF!1 (initially A1, but column A was deleted).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4579 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -1094,13 +1094,15 @@ begin
|
|||||||
if ParseCellRangeString(FToken, r1, c1, r2, c2, flags) then
|
if ParseCellRangeString(FToken, r1, c1, r2, c2, flags) then
|
||||||
Result := ttCellRange
|
Result := ttCellRange
|
||||||
else
|
else
|
||||||
ScanError(Format(SErrInvalidCellRange, [FToken]));
|
Result := ttError;
|
||||||
|
// ScanError(Format(SErrInvalidCellRange, [FToken]));
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
if ParseCellString(FToken, r1, c1, flags) then
|
if ParseCellString(FToken, r1, c1, flags) then
|
||||||
Result := ttCell
|
Result := ttCell
|
||||||
else
|
else
|
||||||
ScanError(Format(SErrInvalidCell, [FToken]));
|
Result := ttError;
|
||||||
|
// ScanError(Format(SErrInvalidCell, [FToken]));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -2625,21 +2627,32 @@ constructor TsConstExprNode.CreateError(AParser: TsExpressionParser;
|
|||||||
var
|
var
|
||||||
err: TsErrorValue;
|
err: TsErrorValue;
|
||||||
begin
|
begin
|
||||||
if AValue = '#NULL!' then
|
// Don't check for equal strings. If, for example, the column A of a cell
|
||||||
|
// reference A1 is deleted Excel replaces the A by '#REF!', i.e the
|
||||||
|
// reference becomes '#REF!1' (with the 1 at the end)!
|
||||||
|
if pos('#NULL!', AValue) > 0 then
|
||||||
|
// if AValue = '#NULL!' then
|
||||||
err := errEmptyIntersection
|
err := errEmptyIntersection
|
||||||
else if AValue = '#DIV/0!' then
|
else if Pos('#DIV/0!', AValue) > 0 then
|
||||||
|
// else if AValue = '#DIV/0!' then
|
||||||
err := errDivideByZero
|
err := errDivideByZero
|
||||||
else if AValue = '#VALUE!' then
|
// else if AValue = '#VALUE!' then
|
||||||
|
else if Pos('#VALUE!', AValue) > 0 then
|
||||||
err := errWrongType
|
err := errWrongType
|
||||||
else if AVAlue = '#REF!' then
|
// else if AValue = '#REF!' then
|
||||||
|
else if Pos('#REF!', AValue) > 0 then
|
||||||
err := errIllegalRef
|
err := errIllegalRef
|
||||||
else if AVAlue = '#NAME?' then
|
// else if AValue = '#NAME?' then
|
||||||
|
else if Pos('#NAME?', AValue) > 0 then
|
||||||
err := errWrongName
|
err := errWrongName
|
||||||
else if AValue = '#NUM!' then
|
// else if AValue = '#NUM!' then
|
||||||
|
else if Pos('#NUM!', AValue) > 0 then
|
||||||
err := errOverflow
|
err := errOverflow
|
||||||
else if AValue = '#N/A' then
|
// else if AValue = '#N/A' then
|
||||||
|
else if Pos('#N/A', AValue) > 0 then
|
||||||
err := errArgError
|
err := errArgError
|
||||||
else if AValue = '#FORMULA?' then
|
// else if AValue = '#FORMULA?' then
|
||||||
|
else if Pos('#FORMULA?', AValue) > 0 then
|
||||||
err := errFormulaNotSupported
|
err := errFormulaNotSupported
|
||||||
else
|
else
|
||||||
AParser.ParserError('Unknown error type.');
|
AParser.ParserError('Unknown error type.');
|
||||||
|
Reference in New Issue
Block a user