Skip to content

Commit cbec751

Browse files
authored
Merge pull request #483 from icarus-consulting/i482-FixNullExceptionOnLiveList
fix listenvelope to move enumerator correctly
2 parents c55ad92 + fdf3aa5 commit cbec751

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Yaapii.Atoms/Lists/ListEnvelope.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public T this[int index]
108108
}
109109
var enumerator = this.origin();
110110
var idx = -1;
111-
while (index >= 0 && enumerator.MoveNext() && idx < index)
111+
while (index >= 0 && idx < index && enumerator.MoveNext() )
112112
{
113113
idx++;
114114
}

tests/Yaapii.Atoms.Tests/Lists/LiveListTest.cs

+9
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ namespace Yaapii.Atoms.List.Tests
3131
{
3232
public sealed class LiveListTest
3333
{
34+
[Fact]
35+
public void WorksWithMultipleValues()
36+
{
37+
var list = new LiveList<string>("one", "two");
38+
Assert.NotNull(
39+
list[1]
40+
);
41+
}
42+
3443
[Fact]
3544
public void KnowsIfEmpty()
3645
{

0 commit comments

Comments
 (0)