Skip to content

Commit e4de925

Browse files
committed
fix(XMLDiff): correct matchedEnough logic for child element comparison to avoid infinity looping
1 parent 55c512b commit e4de925

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

XMLDiff/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ private static bool CompareElements(XDocument original, XDocument modified, XEle
418418
var originalChild = originalChildren[i];
419419
var modifiedChild = modifiedChildren[j];
420420

421-
bool matchedEnough = true;
421+
bool matchedEnough = false;
422422
if (originalChild.Name == modifiedChild.Name)
423423
{
424424
var originalAttributes = originalChild.Attributes().ToDictionary(a => a.Name.LocalName, a => a.Value);
@@ -428,6 +428,8 @@ private static bool CompareElements(XDocument original, XDocument modified, XEle
428428

429429
XElement? savedOp = null;
430430

431+
matchedEnough = true;
432+
431433
foreach (var attr in modifiedAttributes)
432434
{
433435
Logger.Debug($"Checking attribute '{attr.Key}' in original element '{originalAttributes.Keys}'.");

0 commit comments

Comments
 (0)