Skip to content

Commit

Permalink
Don't recurse on null in TryExpandTraverser.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcweber committed Nov 5, 2024
1 parent 805f364 commit 819c89b
Show file tree
Hide file tree
Showing 6 changed files with 175 additions and 167 deletions.
12 changes: 10 additions & 2 deletions src/Support.NewtonsoftJson/Extensions/JTokenExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,18 @@ internal static class JTokenExtensions

IEnumerable<TItem> Core()
{
if (recurse.TryTransform<JToken, TItem>(traverserValue, env, out var item))
if (!(traverserValue is JValue { Value: null }))
{
if (recurse.TryTransform<JToken, TItem>(traverserValue, env, out var item))
{
for (var j = 0; j < bulk; j++)
yield return item;
}
}
else
{
for (var j = 0; j < bulk; j++)
yield return item;
yield return default!;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
[
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[]
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
]
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
[
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[]
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
]
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
[
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[]
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
]
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
[
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[]
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
]
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
[
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[]
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
]

0 comments on commit 819c89b

Please sign in to comment.