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
pull/276/head
Nicolas Höft 2020-05-16 08:28:43 +02:00
parent 2e0fc3ca09
commit fc863bf63f
1 changed files with 1 additions and 1 deletions

View File

@ -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)