From de115e20009c49dc3ded7465b84d4535ba24f08d Mon Sep 17 00:00:00 2001 From: ricky Date: Mon, 5 Apr 2021 19:51:41 -0700 Subject: [PATCH] [ASTextNode2] Check that rangeOut is non-nil before dereferencing (#1980) rangeOut is a nullable parameter, but we are treating it as though it is always not null. Make sure it is not null before dereferencing it. --- Source/ASTextNode2.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/ASTextNode2.mm b/Source/ASTextNode2.mm index 6c5e53b4..0efe7a63 100644 --- a/Source/ASTextNode2.mm +++ b/Source/ASTextNode2.mm @@ -702,7 +702,9 @@ static NSArray *DefaultLinkAttributeNames() { continue; } - *rangeOut = NSIntersectionRange(visibleRange, effectiveRange); + if (rangeOut != NULL) { + *rangeOut = NSIntersectionRange(visibleRange, effectiveRange); + } if (attributeNameOut != NULL) { *attributeNameOut = attributeName;