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:
parent
b5893c0a0b
commit
edac0266e5
|
@ -92,6 +92,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public sealed class CellList : SortedList<Cell>
|
public sealed class CellList : SortedList<Cell>
|
||||||
{
|
{
|
||||||
|
private CellList(List<Cell> wrapped)
|
||||||
|
: base(wrapped) {}
|
||||||
|
|
||||||
public CellList() {}
|
public CellList() {}
|
||||||
|
|
||||||
public CellList(IEnumerable<Cell> collection)
|
public CellList(IEnumerable<Cell> collection)
|
||||||
|
|
|
@ -270,6 +270,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (_selectedItems.LastOrDefault()?.RowIndex >= _rowCount)
|
if (_selectedItems.LastOrDefault()?.RowIndex >= _rowCount)
|
||||||
{
|
{
|
||||||
var iLastToKeep = _selectedItems.LowerBoundBinarySearch(static c => c.RowIndex ?? -1, _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);
|
_selectedItems = _selectedItems.Slice(start: 0, length: iLastToKeep + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue