diff --git a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs index 785e0120f5..6c2acbb741 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs @@ -493,18 +493,19 @@ namespace BizHawk.Client.EmuHawk private void DoSelectionBG(List visibleColumns) { Color rowColor = Color.White; + int firstVisibleRow = FirstVisibleRow; int lastVisibleRow = LastVisibleRow; int lastRow = -1; foreach (Cell cell in _selectedItems) { - if (cell.RowIndex > lastVisibleRow || cell.RowIndex < FirstVisibleRow || !VisibleColumns.Contains(cell.Column)) + if (!cell.RowIndex.HasValue || cell.RowIndex > lastVisibleRow || cell.RowIndex < firstVisibleRow || !VisibleColumns.Contains(cell.Column)) { continue; } Cell relativeCell = new Cell { - RowIndex = cell.RowIndex - FirstVisibleRow, + RowIndex = cell.RowIndex - firstVisibleRow, Column = cell.Column, }; relativeCell.RowIndex -= CountLagFramesAbsolute(relativeCell.RowIndex.Value);