mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-15 18:59:54 +00:00
Don't crash on invalid highlight range
This commit is contained in:
parent
9cdeb71e8d
commit
f46418534f
@ -860,7 +860,10 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
|
||||
if let chatListSearchResult = chatListSearchResult {
|
||||
for range in chatListSearchResult.resultRanges {
|
||||
composedString.addAttribute(.foregroundColor, value: theme.messageHighlightedTextColor, range: NSRange(range, in: chatListSearchResult.text))
|
||||
let stringRange = NSRange(range, in: chatListSearchResult.text)
|
||||
if stringRange.location >= 0 && stringRange.location + stringRange.length <= composedString.length {
|
||||
composedString.addAttribute(.foregroundColor, value: theme.messageHighlightedTextColor, range: stringRange)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user