error check for label

This commit is contained in:
Kevin G Christiano 2020-11-11 16:36:03 -05:00
parent 87dd59e593
commit e3a339a857

View File

@ -351,9 +351,13 @@ public typealias ActionBlock = () -> ()
} else {
imageAttachment = Label.getTextAttachmentImage(name: imageName, dimension: fontSize)
}
let mutableString = NSMutableAttributedString()
mutableString.append(NSAttributedString(attachment: imageAttachment))
attributedString.insert(mutableString, at: imageAtt.location)
// Confirm that the intended image location is within range.
if 0...labelText.count ~= imageAtt.location {
let mutableString = NSMutableAttributedString()
mutableString.append(NSAttributedString(attachment: imageAttachment))
attributedString.insert(mutableString, at: imageAtt.location)
}
case let fontAtt as LabelAttributeFontModel:
if let fontStyle = fontAtt.style {