In some cases, we see a crash when HighlightSwift calls func attributedTextFromData(_ data: Data) throws -> AttributedString. The init fails to create the string and mutableString.length is 0. As a result, the range length is invalid, causing the crash
This could be because NSAttributedString.init(data:options:documentAttributes:) should only be called from the main thread when parsing html data.
See the documentation here: https://developer.apple.com/documentation/foundation/nsattributedstring/1524613-init
Don’t call this method from a background thread if the options dictionary includes the documentType attribute with a value of html. If you do, the method tries to synchronize with the main thread, fails, and times out. Calling it from the main thread works, but can still time out if the HTML contains references to external resources.
In some cases, we see a crash when HighlightSwift calls
func attributedTextFromData(_ data: Data) throws -> AttributedString. The init fails to create the string andmutableString.lengthis 0. As a result, the range length is invalid, causing the crashThis could be because
NSAttributedString.init(data:options:documentAttributes:)should only be called from the main thread when parsing html data.See the documentation here: https://developer.apple.com/documentation/foundation/nsattributedstring/1524613-init