From 7578de26dc3d7f7f57740b1e44320f717b13d6f8 Mon Sep 17 00:00:00 2001 From: fuyujia Date: Mon, 27 Sep 2021 16:46:07 +0800 Subject: [PATCH] Fix ios 15 NSTextContentStorage #111 --- .../Source/ARC/NSAttributedString+AttributedStringHook.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JJException/Source/ARC/NSAttributedString+AttributedStringHook.m b/JJException/Source/ARC/NSAttributedString+AttributedStringHook.m index e598da9..d966cfc 100644 --- a/JJException/Source/ARC/NSAttributedString+AttributedStringHook.m +++ b/JJException/Source/ARC/NSAttributedString+AttributedStringHook.m @@ -60,7 +60,7 @@ - (void)hookEnumerateAttribute:(NSString *)attrName inRange:(NSRange)range optio } - (void)hookEnumerateAttributesInRange:(NSRange)range options:(NSAttributedStringEnumerationOptions)opts usingBlock:(void (^)(NSDictionary * _Nonnull, NSRange, BOOL * _Nonnull))block{ - if (range.location + range.length <= self.length) { + if ((range.location + range.length <= self.length) || ((range.location == NSNotFound) && (range.length == 0))) { [self hookEnumerateAttributesInRange:range options:opts usingBlock:block]; }else{ handleCrashException(JJExceptionGuardNSStringContainer,[NSString stringWithFormat:@"NSAttributedString enumerateAttributesInRange range:%@",NSStringFromRange(range)]);