Fix error handling the case where a cookie is not parseable ... in needs to be removed from the array.

This commit is contained in:
rfm 2024-12-23 17:38:45 +00:00
parent 34112fa510
commit e7716e6ed1

View file

@ -161,7 +161,7 @@ static NSMutableArray *GSCookieStrings(NSString *string);
dates and also could have tokens without values. */
while (count-- > 0)
{
NSHTTPCookie *cookie;
NSHTTPCookie *cookie = nil;
NSMutableDictionary *dict;
NSString *onecookie = [cookies objectAtIndex: count];
@ -181,14 +181,14 @@ static NSMutableArray *GSCookieStrings(NSString *string);
[dict setObject: defaultDomain forKey: NSHTTPCookieDomain];
}
cookie = [NSHTTPCookie cookieWithProperties: dict];
if (cookie)
{
[cookies replaceObjectAtIndex: count withObject: cookie];
}
else
{
[cookies removeObjectAtIndex: count];
}
}
if (cookie)
{
[cookies replaceObjectAtIndex: count withObject: cookie];
}
else
{
[cookies removeObjectAtIndex: count];
}
}
return cookies;