Skip to content

Commit 7c35d8f

Browse files
Update HtmlNode.cs
1 parent 545befc commit 7c35d8f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/HtmlAgilityPack.Shared/HtmlNode.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,12 @@ public void SetChildNodesId(HtmlNode chilNode)
10051005
foreach (HtmlNode child in chilNode.ChildNodes)
10061006
{
10071007
_ownerdocument.SetIdForNode(child, child.GetId());
1008+
1009+
if (child.ChildNodes == chilNode.ChildNodes)
1010+
{
1011+
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");
1012+
}
1013+
10081014
SetChildNodesId(child);
10091015
}
10101016
}

0 commit comments

Comments
 (0)