From ac6b5224bb1384962edbd68f65090d380eccc14c Mon Sep 17 00:00:00 2001 From: "nicolas.goutaland" Date: Wed, 12 Sep 2018 11:41:27 +0200 Subject: [PATCH] Fixed crash --- Classes/GONMarkupParserUtils.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Classes/GONMarkupParserUtils.m b/Classes/GONMarkupParserUtils.m index 622bbd1..08b181b 100644 --- a/Classes/GONMarkupParserUtils.m +++ b/Classes/GONMarkupParserUtils.m @@ -28,7 +28,9 @@ + (void)cleanHTMLEntitiesFromString:(NSMutableString *)inputString options:0 range:NSMakeRange(0, inputString.length) usingBlock:^(NSTextCheckingResult * _Nullable result, NSMatchingFlags flags, BOOL * _Nonnull stop) { - [inputString replaceCharactersInRange:result.range withString:[dicEntities objectForKey:[inputString substringWithRange:result.range]]]; + NSString *entity = [dicEntities objectForKey:[inputString substringWithRange:result.range]]; + if (entity) + [inputString replaceCharactersInRange:result.range withString:entity]; }]; }