diff options
author | Jim Westfall <jwestfall@surrealistic.net> | 2014-11-15 20:35:54 +0300 |
---|---|---|
committer | Jim Westfall <jwestfall@surrealistic.net> | 2014-11-15 20:35:54 +0300 |
commit | 24742dc038d520294578cf29a756b943ade221b9 (patch) | |
tree | dab17bc289579b0c92d05c6ce46f07826438a1c7 /mcs/class/Managed.Windows.Forms | |
parent | ad651ff43bb1d9284843fadd2f27136325a7188a (diff) |
[MWF] Fix off-by-one from 5a5c683
first_row_index needs to be <= RowsLeft - 1, since we are comparing a
row count vs an index.
Diffstat (limited to 'mcs/class/Managed.Windows.Forms')
-rw-r--r-- | mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs index fc213814767..3ce4ab7b574 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs @@ -5137,8 +5137,11 @@ namespace System.Windows.Forms { if (RowsLeft < 0) RowsLeft = 0; - if (first_row_index > RowsLeft) - first_row_index = RowsLeft; + if (first_row_index > RowsLeft - 1) + first_row_index = RowsLeft - 1; + + if (first_row_index < 0) + first_row_index = 0; if (RowsLeft == 0) { MoveCurrentCell (-1, -1, true, false, false, true); |