Skip to content

Commit d366b87

Browse files
Don't allow ChildNodesHelper.Count to be less than zero
1 parent dd0740e commit d366b87

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Compiler/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorIntermediateNodeLoweringPhase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ protected static SyntaxList<SyntaxToken> MergeLiterals(
526526
/// </summary>
527527
protected readonly struct ChildNodesHelper(ChildSyntaxList list, int start = 0)
528528
{
529-
public int Count { get; } = list.Count - start;
529+
public int Count { get; } = Math.Max(list.Count - start, 0);
530530

531531
public SyntaxNode this[int index] => list[start + index];
532532

0 commit comments

Comments
 (0)