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)]);