error check.

This commit is contained in:
Kevin G Christiano 2021-02-23 15:33:03 -05:00
parent 8a861077dd
commit cd94f99f60

View File

@ -836,7 +836,10 @@ extension Label {
fileprivate func setActionAttributes(range: NSRange) {
guard let attributedText = attributedText else { return }
guard let attributedText = attributedText,
range.length > 0,
range.length <= attributedText.length
else { return }
let mutableAttributedString = NSMutableAttributedString(attributedString: attributedText)
addActionAttributes(range: range, string: mutableAttributedString)