From 967ce66e9ed2c82da32789b70d4d92ff9450550d Mon Sep 17 00:00:00 2001 From: James Groom Date: Fri, 15 Mar 2024 12:01:58 +0000 Subject: [PATCH] Use helper prop in `InputRoll`, simplifying LINQ call --- .../CustomControls/InputRoll/InputRoll.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs b/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs index 36bbdff2e6..ed7f63a9aa 100644 --- a/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs +++ b/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs @@ -952,7 +952,7 @@ namespace BizHawk.Client.EmuHawk [Browsable(false)] private IEnumerable SelectedRowsWithDuplicates - => _selectedItems.Where(static cell => cell.RowIndex is not null).Select(static cell => cell.RowIndex.Value); + => _selectedItems.Select(static cell => cell.RowIndex ?? -1).Where(static i => i >= 0); [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -1168,13 +1168,7 @@ namespace BizHawk.Client.EmuHawk if (!selected) { - var rowIndices = _selectedItems - .Where(c => c.RowIndex.HasValue) - .Select(c => c.RowIndex ?? -1) - .Where(c => c >= 0) // Hack to avoid possible Nullable exceptions - .Distinct() - .ToList(); - + var rowIndices = SelectedRows.ToList(); var firstIndex = rowIndices.Min(); var lastIndex = rowIndices.Max();