added validators for invalid range
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
9203b6cab5
commit
1d9667c173
@ -56,6 +56,8 @@ public struct ActionLabelAttribute: ActionLabelAttributeModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func setAttribute(on attributedString: NSMutableAttributedString) {
|
public func setAttribute(on attributedString: NSMutableAttributedString) {
|
||||||
|
guard isValidRange(on: attributedString) else { return }
|
||||||
|
|
||||||
if(shouldUnderline){
|
if(shouldUnderline){
|
||||||
UnderlineLabelAttribute(location: location, length: length).setAttribute(on: attributedString)
|
UnderlineLabelAttribute(location: location, length: length).setAttribute(on: attributedString)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,8 @@ public protocol AttachmentLabelAttributeModel: LabelAttributeModel {
|
|||||||
|
|
||||||
extension AttachmentLabelAttributeModel {
|
extension AttachmentLabelAttributeModel {
|
||||||
public func setAttribute(on attributedString: NSMutableAttributedString) {
|
public func setAttribute(on attributedString: NSMutableAttributedString) {
|
||||||
|
guard isValidRange(on: attributedString) else { return }
|
||||||
|
|
||||||
do {
|
do {
|
||||||
let mutableString = NSMutableAttributedString()
|
let mutableString = NSMutableAttributedString()
|
||||||
let attachment = try getAttachment()
|
let attachment = try getAttachment()
|
||||||
|
|||||||
@ -24,7 +24,9 @@ public class TooltipLabelAttribute: ActionLabelAttributeModel, TooltipLaunchable
|
|||||||
public var presenter: UIView?
|
public var presenter: UIView?
|
||||||
|
|
||||||
public func setAttribute(on attributedString: NSMutableAttributedString) {
|
public func setAttribute(on attributedString: NSMutableAttributedString) {
|
||||||
//update the location
|
guard isValidRange(on: attributedString) else { return }
|
||||||
|
|
||||||
|
//update the location
|
||||||
location = attributedString.string.count - 1
|
location = attributedString.string.count - 1
|
||||||
|
|
||||||
//set the default color off surface for text
|
//set the default color off surface for text
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user