Skip to content

Commit

Permalink
Merge pull request #144 from CoreyKaylor/fix-enumerable
Browse files Browse the repository at this point in the history
Fix AsEnumerable silent failure
  • Loading branch information
CoreyKaylor authored Sep 6, 2021
2 parents 2a8791b + b333309 commit 6c5e3df
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/LightningDB/LightningExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,12 @@ private static string mdb_strerror(int err)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IEnumerable<ValueTuple<MDBValue, MDBValue>> AsEnumerable(this LightningCursor cursor)
{
do
while(cursor.Next() == MDBResultCode.Success)
{
var (resultCode, key, value) = cursor.GetCurrent();
if (resultCode == MDBResultCode.Success)
{
yield return (key, value);
}
} while (cursor.Next() == MDBResultCode.Success);
resultCode.ThrowOnError();
yield return (key, value);
}
}

/// <summary>
Expand Down

0 comments on commit 6c5e3df

Please sign in to comment.