tid-kijyun / Kanna

Kanna(鉋) is an XML/HTML parser for Swift.
MIT License
2.42k stars 221 forks source link

Crash when parsing HTML string with the value of " " #242

Closed ivan-magda closed 3 years ago

ivan-magda commented 4 years ago

Description:

With the latest release 5.2.3, I discovered crashes when parsing HTML:

Fatal error: Unexpectedly found nil while implicitly unwrapping an 
Optional value: file Kanna/libxmlHTMLNode.swift, line 144

Code to reproduce:

try? Kanna.HTML(html: " ", encoding: String.Encoding.utf8)

Installation method:

Kanna version (or commit hash):

5.2.3

swift --version

5.3

Xcode version (optional):

12.0.1

krishjainx commented 3 years ago

@ivan-magda I think I can fix this. It simply involves modifying the libxmlHTMLNode.swift file. Can this be assigned to me?

tid-kijyun commented 3 years ago

I'm sorry I missed this report. @Krish-sysadmin Please make a PR if possible.

Thanks

krishjainx commented 3 years ago

Ok @tid-kijyun . Will make it as soon as I am free. Thanks for providing such an amazing parser!

krishjainx commented 3 years ago

I submitted a PR @tid-kijyun

tid-kijyun commented 3 years ago

I've just released new version 5.2.6. Please try it.