Skip to content

Commit 3b4c70c

Browse files
authored
Merge pull request #131 from koculu/codex/remove-null-condition-from-loops
Fix infinite loop bug in array conversion methods
2 parents a0a1dbc + 3723a16 commit 3b4c70c

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/ZoneTree/Collections/SingleProducerSingleConsumerQueue.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,7 @@ public IReadOnlyList<TQueueItem> ToFirstInFirstArray()
6868

6969
while (start != end)
7070
{
71-
var item = items[start];
72-
if (item == null)
73-
continue;
74-
list.Add(item);
71+
list.Add(items[start]);
7572
start = (start + 1) % size;
7673
}
7774
return list;
@@ -87,10 +84,7 @@ public IReadOnlyList<TQueueItem> ToLastInFirstArray()
8784

8885
while (start != end)
8986
{
90-
var item = items[end];
91-
if (item == null)
92-
continue;
93-
list.Add(item);
87+
list.Add(items[end]);
9488
end = (size + end - 1) % size;
9589
}
9690
return list;

0 commit comments

Comments
 (0)