ensure range is valid.
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
1d9667c173
commit
0fc70e9f75
@ -344,7 +344,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
|||||||
for attribute in attributes {
|
for attribute in attributes {
|
||||||
|
|
||||||
//see if the attribute is Actionable
|
//see if the attribute is Actionable
|
||||||
if let actionable = attribute as? any ActionLabelAttributeModel{
|
if let actionable = attribute as? any ActionLabelAttributeModel, mutableAttributedString.isValid(range: actionable.range) {
|
||||||
//create a accessibleAction
|
//create a accessibleAction
|
||||||
let customAccessibilityAction = customAccessibilityAction(text: mutableAttributedString.string, range: actionable.range, accessibleText: actionable.accessibleText)
|
let customAccessibilityAction = customAccessibilityAction(text: mutableAttributedString.string, range: actionable.range, accessibleText: actionable.accessibleText)
|
||||||
|
|
||||||
@ -379,7 +379,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
|||||||
|
|
||||||
guard let text = text, let attributedText else { return nil }
|
guard let text = text, let attributedText else { return nil }
|
||||||
|
|
||||||
let actionText = accessibleText ?? NSString(string:text).substring(with: range)
|
let actionText = accessibleText ?? (text.isValid(range: range) ? NSString(string:text).substring(with: range) : text)
|
||||||
|
|
||||||
// Calculate the frame of the substring
|
// Calculate the frame of the substring
|
||||||
let layoutManager = NSLayoutManager()
|
let layoutManager = NSLayoutManager()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user