Skip to content

Commit

Permalink
Update HtmlNode.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanMagnan committed Sep 9, 2023
1 parent 545befc commit 7c35d8f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/HtmlAgilityPack.Shared/HtmlNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,12 @@ public void SetChildNodesId(HtmlNode chilNode)
foreach (HtmlNode child in chilNode.ChildNodes)
{
_ownerdocument.SetIdForNode(child, child.GetId());

if (child.ChildNodes == chilNode.ChildNodes)
{
throw new Exception("Oops! a scenario that will cause a Stack Overflow has been found. See the following issue for an example: https://github.com/zzzprojects/html-agility-pack/issues/513");
}

SetChildNodesId(child);
}
}
Expand Down

0 comments on commit 7c35d8f

Please sign in to comment.