From b38dcbe73708219b144d6b3740722c042af6529e Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Mon, 17 Jun 2019 15:09:48 +0000 Subject: [PATCH] fpspreadsheet: Fix index bug in TsWorksheet.SetIndex (reported by forum user "iteh") git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7012 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/fpspreadsheet/source/common/fpspreadsheet.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/fpspreadsheet/source/common/fpspreadsheet.pas b/components/fpspreadsheet/source/common/fpspreadsheet.pas index d9435e659..edfd94835 100644 --- a/components/fpspreadsheet/source/common/fpspreadsheet.pas +++ b/components/fpspreadsheet/source/common/fpspreadsheet.pas @@ -7283,8 +7283,8 @@ begin if AValue < 0 then AValue := 0 else - if AValue > TsWorkbook(FWorkbook).GetWorksheetCount then - Avalue := TsWorkbook(FWorkbook).GetWorksheetCount - 1; + if AValue >= TsWorkbook(FWorkbook).GetWorksheetCount then + AValue := TsWorkbook(FWorkbook).GetWorksheetCount - 1; oldIndex := GetIndex; if oldIndex <> AValue then TsWorkbook(FWorkbook).MoveSheet(oldIndex, Avalue);