mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-03-27 09:16:28 +00:00
Don't crash on invalid highlight range
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user