Skip to content

Commit 67c03e7

Browse files
committed
Fix crash when updating underline text for special glyphs
1 parent 3fb6827 commit 67c03e7

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Aztec/Classes/TextKit/LayoutManager.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,12 @@ extension LayoutManager {
366366
guard let textStorage = textStorage else {
367367
return
368368
}
369+
370+
guard Range(glyphRange, in: textStorage.string) != nil else {
371+
// range out of bound for the glyph, fallback to default behavior
372+
return super.underlineGlyphRange(glyphRange, underlineType: underlineVal, lineFragmentRect: lineRect, lineFragmentGlyphRange: lineGlyphRange, containerOrigin: containerOrigin)
373+
}
374+
369375
let underlinedString = textStorage.attributedSubstring(from: glyphRange).string
370376
var updatedGlyphRange = glyphRange
371377
if glyphRange.endLocation == lineGlyphRange.endLocation,

0 commit comments

Comments
 (0)