fpspreadsheet: Fix crash when a row is deleted with a formula and referenced cells of another formula (see discussion in https://forum.lazarus.freepascal.org/index.php/topic,41161.msg287707.html#msg287707).

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6452 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-06-02 16:35:14 +00:00
parent 3edd24a215
commit 115a423be5

View File

@ -1453,11 +1453,12 @@ begin
// Remove and destroy the formula record if it is in the deleted row
if formula^.Row = AIndex then
Delete(node)
else
if formula^.Row > AIndex then
dec(formula^.Row);
// Update all RowCol records at row indexes above the deleted row
changed := formula^.Parser.IterateNodes(@FixDeletedRow, Pointer(PtrInt(AIndex)));
else begin
if formula^.Row > AIndex then
dec(formula^.Row);
// Update all RowCol records at row indexes above the deleted row
changed := formula^.Parser.IterateNodes(@FixDeletedRow, Pointer(PtrInt(AIndex)));
end;
end else
begin
// Remove and destroy the formula record if it is in the deleted column