Skip to content
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

Fix crash when underlining text with special glyphs #1384

Merged
merged 3 commits into from
Feb 2, 2024

Conversation

itsmeichigo
Copy link
Contributor

Fixes woocommerce/woocommerce-ios#11866

Description

We have a custom implementation for underlining text, and the logic involves checking for a range of glyphs in strings. For text with special glyphs (e.g. Arabic language), this range is sometimes out of the bound of the text (I have yet to find an exact explanation for this).

The fix is to fall back to using the default implementation if we detect that a glyph range is invalid.

Testing steps

  • Run the demo app
  • Open the content Underline NBSP
  • Check that underlines are drawn correctly and the app doesn't crash.

  • I have considered if this change warrants release notes and have added them to the appropriate section in the CHANGELOG.md if necessary.

Copy link

@selanthiraiyan selanthiraiyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good to me. :shipit:

@itsmeichigo itsmeichigo merged commit de17020 into develop Feb 2, 2024
6 checks passed
@itsmeichigo itsmeichigo deleted the fix/crash-underline-special-glyph branch February 2, 2024 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NSRangeException: Aztec.TextStorage attributedSubstringFromRange:: Out of bounds
2 participants