diff --git a/lcl/grids.pas b/lcl/grids.pas index 63e71dbfa3..f371e761f5 100644 --- a/lcl/grids.pas +++ b/lcl/grids.pas @@ -9887,9 +9887,12 @@ begin try L.Text := TheText; for j:=0 to L.Count-1 do begin + if j+StartRow >= RowCount then + break; CollectCols(L[j]); for i:=0 to SubL.Count-1 do - Cells[i + StartCol, j + StartRow] := SubL[i]; + if (i+StartCol