added validators for invalid range

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-03-20 15:24:59 -05:00
parent 9203b6cab5
commit 1d9667c173
3 changed files with 7 additions and 1 deletions

View File

@ -56,6 +56,8 @@ public struct ActionLabelAttribute: ActionLabelAttributeModel {
}
public func setAttribute(on attributedString: NSMutableAttributedString) {
guard isValidRange(on: attributedString) else { return }
if(shouldUnderline){
UnderlineLabelAttribute(location: location, length: length).setAttribute(on: attributedString)
}

View File

@ -14,6 +14,8 @@ public protocol AttachmentLabelAttributeModel: LabelAttributeModel {
extension AttachmentLabelAttributeModel {
public func setAttribute(on attributedString: NSMutableAttributedString) {
guard isValidRange(on: attributedString) else { return }
do {
let mutableString = NSMutableAttributedString()
let attachment = try getAttachment()

View File

@ -24,7 +24,9 @@ public class TooltipLabelAttribute: ActionLabelAttributeModel, TooltipLaunchable
public var presenter: UIView?
public func setAttribute(on attributedString: NSMutableAttributedString) {
//update the location
guard isValidRange(on: attributedString) else { return }
//update the location
location = attributedString.string.count - 1
//set the default color off surface for text