mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 00:02:50 +02:00
LCL/StringGrid: Fix crash when Columns are exchanged and column indices are specified in reverse order.
(cherry picked from commit 478e5101d9
)
This commit is contained in:
parent
1c8d13354d
commit
bc8d0d2ae5
@ -13120,8 +13120,15 @@ begin
|
||||
if HasIndex(Index) then
|
||||
if HasIndex(WithIndex) then begin
|
||||
BeginUpdate;
|
||||
Items[WithIndex].Index := Index;
|
||||
Items[Index+1].Index := WithIndex;
|
||||
if Index < WithIndex then
|
||||
begin
|
||||
Items[WithIndex].Index := Index;
|
||||
Items[Index+1].Index := WithIndex;
|
||||
end else
|
||||
begin
|
||||
Items[Index].Index := WithIndex;
|
||||
Items[WithIndex+1].Index := Index;
|
||||
end;
|
||||
EndUpdate;
|
||||
end else
|
||||
raise Exception.Create('WithIndex out of range')
|
||||
|
Loading…
Reference in New Issue
Block a user