doing extra guards for actionMap and actionText range to ensure a valid ActionLabelAttribute gets created.
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
82b5c0e655
commit
20cd7acce2
@ -421,6 +421,8 @@ extension Label {
|
|||||||
|
|
||||||
/// Underlines the tappable region and stores the tap logic for interation.
|
/// Underlines the tappable region and stores the tap logic for interation.
|
||||||
private func setTextLinkState(range: NSRange, actionBlock: @escaping ActionBlock) {
|
private func setTextLinkState(range: NSRange, actionBlock: @escaping ActionBlock) {
|
||||||
|
guard range.length > 0 else { return }
|
||||||
|
|
||||||
var textLink = ActionLabelAttribute(location: range.location, length: range.length)
|
var textLink = ActionLabelAttribute(location: range.location, length: range.length)
|
||||||
textLink.subscriber = textLink
|
textLink.subscriber = textLink
|
||||||
.action
|
.action
|
||||||
@ -440,6 +442,8 @@ extension Label {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func createActionBlockFor(actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) -> ActionBlock? {
|
public func createActionBlockFor(actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) -> ActionBlock? {
|
||||||
|
guard let actionMap else { return nil }
|
||||||
|
|
||||||
return { [weak self] in
|
return { [weak self] in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user