From 3abdff49a71d931fca21d3d658365481c9e00ea8 Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 22 Nov 2014 09:50:19 +0000 Subject: [PATCH] Catch & ignore InvalidOperationException when scrolling * Fix for a crash report - this exception can be thrown sometimes if the window is really small. --- renderdocui/Windows/BufferViewer.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/renderdocui/Windows/BufferViewer.cs b/renderdocui/Windows/BufferViewer.cs index bd6ba68b7..cf442c308 100644 --- a/renderdocui/Windows/BufferViewer.cs +++ b/renderdocui/Windows/BufferViewer.cs @@ -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. } }