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