From 81c099d5f9a813f52b67cd7080e40b9106d9542d Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 31 Mar 2021 11:08:56 -0400 Subject: [PATCH] length check for attrivutes --- MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift index e8c8446f..c24c880e 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift @@ -828,7 +828,10 @@ extension Label { private func addActionAttributes(range: NSRange, string: NSMutableAttributedString?) { - guard let string = string else { return } + guard let string = string, + string.length >= range.length + else { return } + string.addAttributes([NSAttributedString.Key.underlineStyle: NSUnderlineStyle.single.rawValue], range: range) }