Fix stack enumerator for empty chunks

This commit is contained in:
Marek Lemańczyk committed 2025-07-16 00:20:25 +02:00
1 parent 7e71abdcf2
commit 4274f4dcbc
5 files changed
+1624 -21

No files matched your search

+15 -11
View File
@@ -199,23 +199,27 @@ namespace Recyclable.Collections
public bool MoveNext()
{
if (_chunk == null)
while (true)
{
return false;
}
if (_index < 0)
{
_chunk = _chunk.Previous;
if (_chunk == null)
{
return false;
}
_index = _chunk.Index - 1;
}
_current = _chunk.Value[_index--];
return true;
if (_index < 0)
{
_chunk = _chunk.Previous;
if (_chunk == null)
{
return false;
}
_index = _chunk.Index - 1;
continue;
}
_current = _chunk.Value[_index--];
return true;
}
}
public void Reset()