We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ea62827 + cf551cf commit 74a3090Copy full SHA for 74a3090
1 file changed
Sources/Attributer.swift
@@ -565,6 +565,7 @@ open class Attributer {
565
*/
566
open func makeInteract(_ callback: @escaping ((_ link: String) -> ())) -> Attributer {
567
for nsRange in self.ranges {
568
+ guard nsRange.location != NSNotFound else { return self }
569
let unEscapedString = (self.attributedText.string as NSString).substring(with: nsRange)
570
let escapedString = unEscapedString.addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlHostAllowed) ?? ""
571
self.attributedText.addAttribute(NSAttributedString.Key.link, value: "AttributedTextView:\(escapedString)", range: nsRange)
0 commit comments