length check for attrivutes
This commit is contained in:
parent
83a5ed62d6
commit
81c099d5f9
@ -828,7 +828,10 @@ extension Label {
|
|||||||
|
|
||||||
private func addActionAttributes(range: NSRange, string: NSMutableAttributedString?) {
|
private func addActionAttributes(range: NSRange, string: NSMutableAttributedString?) {
|
||||||
|
|
||||||
guard let string = string else { return }
|
guard let string = string,
|
||||||
|
string.length >= range.length
|
||||||
|
else { return }
|
||||||
|
|
||||||
string.addAttributes([NSAttributedString.Key.underlineStyle: NSUnderlineStyle.single.rawValue], range: range)
|
string.addAttributes([NSAttributedString.Key.underlineStyle: NSUnderlineStyle.single.rawValue], range: range)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user