From fc863bf63f33322767556c6c3789810a160a8f14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20H=C3=B6ft?= Date: Sat, 16 May 2020 08:28:43 +0200 Subject: [PATCH] fix: Fix for failing test in NSString+Utilities The test in TestNSString+Utilities would otherwise fail: ====================================================================== FAIL: test_countOccurrencesOfString (TestNSString+Utilities.m:46) ---------------------------------------------------------------------- assertion failure Simply leave the loop early if the substring length is zero to avoid this issue --- SoObjects/SOGo/NSString+Utilities.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SoObjects/SOGo/NSString+Utilities.m b/SoObjects/SOGo/NSString+Utilities.m index b7defaa4c..d1facda78 100644 --- a/SoObjects/SOGo/NSString+Utilities.m +++ b/SoObjects/SOGo/NSString+Utilities.m @@ -739,7 +739,7 @@ static int cssEscapingCount; substrLen = [substring length]; matchRange = NSMakeRange (0, selfLen); - while (!done) + while (!done && matchRange.length > 0) { substrRange = [self rangeOfString: substring options: 0 range: matchRange]; if (substrRange.location == NSNotFound)