From 7504fdfa4529ac01b77ab83bfee51a5f06e3e6d1 Mon Sep 17 00:00:00 2001 From: Kelly <57497291+kellyo-cricut@users.noreply.github.com> Date: Thu, 2 Feb 2023 11:08:51 -0800 Subject: [PATCH] Fix XML parsing in WASI environment (#4683) * Fix XML parsing in WASI environment Final chunk of XML document was being skipped when parsing when in a WASI environment * Update XMLParser.swift --------- Co-authored-by: Max Desiatov --- Sources/FoundationXML/XMLParser.swift | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Sources/FoundationXML/XMLParser.swift b/Sources/FoundationXML/XMLParser.swift index befc828212..501c9670a1 100644 --- a/Sources/FoundationXML/XMLParser.swift +++ b/Sources/FoundationXML/XMLParser.swift @@ -601,10 +601,7 @@ open class XMLParser : NSObject { var result = true var chunkStart = 0 var chunkEnd = min(_chunkSize, data.count) - while result { - if chunkStart >= data.count || chunkEnd >= data.count { - break - } + while result && chunkStart < chunkEnd { let chunk = data[chunkStart..