Commit ed3cfadc authored by Bart B's avatar Bart B 🐞
Browse files

LCL: fix crash in TStringGrid.InsertRowWithValues is Columns.Enabled is True. Issue #36067

git-svn-id: trunk@61946 -
parent 96eee65d
......@@ -11761,11 +11761,19 @@ end;
procedure TCustomStringGrid.InsertRowWithValues(Index: Integer;
Values: array of String);
var
i, OldRC: Integer;
i, OldRC, Diff: Integer;
begin
OldRC := RowCount;
if Length(Values) > ColCount then
ColCount := Length(Values);
Diff := Length(Values) - ColCount;
if Diff > 0 then
begin
if Columns.Enabled then
begin
for i := 1 to Diff do with Columns.Add do Title.Caption := '';
end
else
ColCount := Length(Values);
end;
InsertColRow(false, Index);
//if RowCount was 0, then setting ColCount restores RowCount (from FGridPropBackup)
//which is unwanted here, so reset it (Issue #0026943)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment