Skip to content

Commit

Permalink
Merge pull request #6146 from FoggyFinder/issue6127
Browse files Browse the repository at this point in the history
Prevent `ScrollSlotIntoView` from crashing on start
  • Loading branch information
jmacato authored Jul 1, 2021
2 parents b54a965 + 11a6d04 commit 59f8996
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Avalonia.Controls.DataGrid/DataGridRows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ internal bool ScrollSlotIntoView(int slot, bool scrolledHorizontally)
UpdateDisplayedRows(DisplayData.FirstScrollingSlot, CellsHeight);
}

if (DisplayData.FirstScrollingSlot < slot && DisplayData.LastScrollingSlot > slot)
if (DisplayData.FirstScrollingSlot < slot && (DisplayData.LastScrollingSlot > slot || DisplayData.LastScrollingSlot == -1))
{
// The row is already displayed in its entirety
return true;
Expand Down

0 comments on commit 59f8996

Please sign in to comment.