-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash #77
Comments
will fix asap, thanks for your feedback |
Did it happen on iOS18? |
I found the parser works weirdly on iOS18. 🤔 |
Yes I think so. |
Thank you all for your feedback and assistance. private extension NSAttributedString.Key {
static let breaklinePlaceholder: NSAttributedString.Key = .init("breaklinePlaceholder")
struct BreaklinePlaceholder: OptionSet {
let rawValue: Int
static let tagBoundaryPrefix = BreaklinePlaceholder(rawValue: 1)
static let tagBoundarySuffix = BreaklinePlaceholder(rawValue: 2)
static let breaklineTag = BreaklinePlaceholder(rawValue: 3)
}
} The root cause is that the custom NSAttributedString.Key requires an extension from Hashable. Otherwise, on iOS 18 and above, it will throw the following error:
This leads to a subsequent crash:
However, the expected behavior is to record each breakline position and merge them according to the rules. If we simply extend the struct with BreaklinePlaceholder: OptionSet, Hashable, the system will automatically merge repeated BreaklinePlaceholder, which is not what we want. Therefore, I changed it to use a class declaration for the placeholder to maintain the original merging logic. I also adjusted the crash point in For more details, please refer to this PR. #78 |
Thank you for fixing this crash! |
the full story: https://en.zhgchg.li/posts/9e43897d99fc/ |
snippet.txt
The attached HTML snippet causes a crash
within MarkupNSAttributedStringVisitor#reduceBreaklineInResultNSAttributedString
Probably the HTML is malformed, but ZMarkupParser should fail more gracefully.
Thanks!
The text was updated successfully, but these errors were encountered: