RecyclableLongList.Remove & .RemoveAt fixed to correctly set _lastBlockWithData to -1, when we remove the last item.
This commit is contained in:
1 parent
268dbb5b1d
commit
5a2ae1c261
1 file changed
+18
-12
@@ -921,10 +921,7 @@ namespace Recyclable.Collections
|
||||
|
||||
if (_nextItemIndex > 0)
|
||||
{
|
||||
if (--_nextItemIndex == 0)
|
||||
{
|
||||
_lastBlockWithData--;
|
||||
}
|
||||
_nextItemIndex--;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -932,6 +929,11 @@ namespace Recyclable.Collections
|
||||
_nextItemBlockIndex--;
|
||||
}
|
||||
|
||||
if (_nextItemIndex == 0)
|
||||
{
|
||||
_lastBlockWithData--;
|
||||
}
|
||||
|
||||
if (NeedsClearing)
|
||||
{
|
||||
#nullable disable
|
||||
@@ -987,10 +989,7 @@ namespace Recyclable.Collections
|
||||
|
||||
if (_nextItemIndex > 0)
|
||||
{
|
||||
if (--_nextItemIndex == 0)
|
||||
{
|
||||
_lastBlockWithData--;
|
||||
}
|
||||
_nextItemIndex--;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -998,6 +997,11 @@ namespace Recyclable.Collections
|
||||
_nextItemBlockIndex--;
|
||||
}
|
||||
|
||||
if (_nextItemIndex == 0)
|
||||
{
|
||||
_lastBlockWithData--;
|
||||
}
|
||||
|
||||
if (NeedsClearing)
|
||||
{
|
||||
#nullable disable
|
||||
@@ -1023,10 +1027,7 @@ namespace Recyclable.Collections
|
||||
|
||||
if (_nextItemIndex > 0)
|
||||
{
|
||||
if (--_nextItemIndex == 0)
|
||||
{
|
||||
_lastBlockWithData--;
|
||||
}
|
||||
_nextItemIndex--;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1034,6 +1035,11 @@ namespace Recyclable.Collections
|
||||
_nextItemBlockIndex--;
|
||||
}
|
||||
|
||||
if (_nextItemIndex == 0)
|
||||
{
|
||||
_lastBlockWithData--;
|
||||
}
|
||||
|
||||
if (NeedsClearing)
|
||||
{
|
||||
#nullable disable
|
||||
|
||||
Reference in new issue
Block a user