Hi all,

I have the following code that throws an error in FPC and runs fine in Delphi:

procedure TForm1.BitBtn1Click(Sender: TObject);
var
  MyStringGrid: TStringGrid;
begin
  MyStringGrid := TStringGrid.Create(nil);
  try
    MyStringGrid.RowCount := 0;
    MyStringGrid.RowHeights[0] := 1;
  finally
    MyStringGrid.Free;
  end;
end;

Delphi checks if the grid has at least 
In FPC there is no check on RowCount before the height is set, resulting in a 
List index(0) out of bounds exception. Although it is correct, it is annoying 
:-)

It can be fixed by adding something like this to the beginning of 
TCustomGrid.Setrowheights:

  if ARow <= FRows.Count then EXIT;

Shall I file a report for this?

Kind regards,
  Birger Jansen
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to