Catch & ignore InvalidOperationException when scrolling

* Fix for a crash report - this exception can be thrown sometimes if the
  window is really small.
This commit is contained in:
baldurk
2014-11-22 09:50:19 +00:00
parent caa5e06644
commit 3abdff49a7
+13 -6
View File
@@ -1658,13 +1658,20 @@ namespace renderdocui.Windows
private void ScrollToRow(DataGridView view, int r)
{
int row = Math.Max(0, Math.Min(r, view.RowCount - 1));
if (row < view.RowCount)
try
{
view.FirstDisplayedScrollingRowIndex = row;
view.ClearSelection();
view.Rows[row].Selected = true;
int row = Math.Max(0, Math.Min(r, view.RowCount - 1));
if (row < view.RowCount)
{
view.FirstDisplayedScrollingRowIndex = row;
view.ClearSelection();
view.Rows[row].Selected = true;
}
}
catch (InvalidOperationException)
{
// this can happen when the window is too small, all we can do is ignore it.
}
}