LCL, dbgrid: fix exception on adding second record (regression caused by r51914 #5224c3c339), fixes issues #29802, #29813

git-svn-id: trunk@51918 -
This commit is contained in:
jesus 2016-03-11 16:24:10 +00:00
parent f6c0e626c2
commit 712eae76cd

View File

@ -3381,6 +3381,7 @@ end;
procedure TCustomDBGrid.UpdateActive;
var
PrevRow: Integer;
NewRow: Integer;
begin
if (csDestroying in ComponentState) or
(FDatalink=nil) or (not FDatalink.Active) or
@ -3391,7 +3392,10 @@ begin
[ClassName, Name, FDataLink.ActiveRecord, FixedRows, Row]);
{$endif}
PrevRow := Row;
Row:= FixedRows + FDataLink.ActiveRecord;
NewRow:= FixedRows + FDataLink.ActiveRecord;
if NewRow>RowCount-1 then
NewRow := RowCount-1;
Row := NewRow;
if PrevRow<>Row then
InvalidateCell(0, PrevRow);//(InvalidateRow(PrevRow);
InvalidateRow(Row);