Skip to content

Commit

Permalink
RevisionGridControl: prevent exception when switching repository
Browse files Browse the repository at this point in the history
  • Loading branch information
pmiossec committed Nov 7, 2021
1 parent a866c36 commit f966ece
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions GitUI/UserControls/RevisionGrid/RevisionGridControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,12 @@ private void SetSelectedIndex(int index, bool toggleSelection = false)
{
_gridView.Select();

// Prevent exception when changing of reporsitory because the grid still contains no rows.
if (index >= _gridView.Rows.Count)
{
return;
}

bool shallSelect;
bool wasSelected = _gridView.Rows[index].Selected;
if (toggleSelection)
Expand Down

0 comments on commit f966ece

Please sign in to comment.