Fix `InputRoll.RowCount`, caused crash on removing row in Lua Console

fixes d7b0af9f4
also I think there was an unnecessary copy because this ctor was missing
This commit is contained in:
YoshiRulz 2025-05-07 13:35:21 +10:00
parent b5893c0a0b
commit edac0266e5
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 4 additions and 0 deletions

View File

@ -92,6 +92,9 @@ namespace BizHawk.Client.EmuHawk
public sealed class CellList : SortedList<Cell>
{
private CellList(List<Cell> wrapped)
: base(wrapped) {}
public CellList() {}
public CellList(IEnumerable<Cell> collection)

View File

@ -270,6 +270,7 @@ namespace BizHawk.Client.EmuHawk
if (_selectedItems.LastOrDefault()?.RowIndex >= _rowCount)
{
var iLastToKeep = _selectedItems.LowerBoundBinarySearch(static c => c.RowIndex ?? -1, _rowCount);
while (iLastToKeep > -1 && (_selectedItems[iLastToKeep + 1].RowIndex ?? -1) >= _rowCount) iLastToKeep--;
_selectedItems = _selectedItems.Slice(start: 0, length: iLastToKeep + 1);
}