mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Fix crash truncating a string of a node with a zero size
The crash happens in the placeholderImage of ASTextNode. The node is not visible in the time it try to get the `placeholderImage` and so the `visibleRange` has count 0 and a crash happens while accessing the first object of an empty array.
This commit is contained in:
@@ -78,7 +78,7 @@
|
||||
The character range from the original attributedString that is displayed by the renderer given the parameters in the
|
||||
initializer.
|
||||
*/
|
||||
- (std::vector<NSRange>)visibleRanges;
|
||||
@property (nonatomic, assign, readonly) std::vector<NSRange> visibleRanges;
|
||||
|
||||
/**
|
||||
The number of lines shown in the string.
|
||||
@@ -86,3 +86,13 @@
|
||||
- (NSUInteger)lineCount;
|
||||
|
||||
@end
|
||||
|
||||
@interface ASTextKitRenderer (ASTextKitRendererConvenience)
|
||||
|
||||
/**
|
||||
Returns the first visible range or an NSRange with location of NSNotFound and size of 0 if no first visible
|
||||
range exists
|
||||
*/
|
||||
@property (nonatomic, assign, readonly) NSRange firstVisibleRange;
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user