From d2467e166d85bbbad66b657a323134b7247de546 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Thu, 10 Nov 2022 18:04:44 +0000 Subject: [PATCH] fpspreadsheet: Fix worksheetgrid crashing when drawing cell borders due to range overflow when frozencols = 0 or frozenrows = 0. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8603 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../source/visual/fpspreadsheetgrid.pas | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas b/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas index c261223ba..21d4bf5da 100644 --- a/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas +++ b/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas @@ -2533,21 +2533,21 @@ begin end; 1: begin sr1 := 0; - sr2 := FFrozenRows - 1; - sc1 := FFrozenCols - 1; + if FFrozenRows = 0 then sr2 := 0 else sr2 := FFrozenRows - 1; + if FFrozenCols = 0 then sc1 := 0 else sc1 := FFrozenCols - 1; sc2 := GetWorksheetCol(GCache.VisibleGrid.Right); end; 2: begin sc1 := 0; - sc2 := FFrozenCols - 1; - sr1 := FFrozenRows - 1; + if FFrozenCols = 0 then sc2 := 0 else sc2 := FFrozenCols - 1; + if FFrozenRows = 0 then sr1 := 0 else sr1 := FFrozenRows - 1; sr2 := GetWorksheetRow(GCache.VisibleGrid.Bottom); end; 3: begin sc1 := 0; - sc2 := FFrozenCols - 1; + if FFrozenCols = 0 then sc2 := 0 else sc2 := FFrozenCols - 1; sr1 := 0; - sr2 := FFrozenRows - 1; + if FFrozenRows = 0 then sr2 := 0 else sr2 := FFrozenRows - 1; end; end; if sr1 = UNASSIGNED_ROW_COL_INDEX then sr1 := 0;