Skip to content

Commit

Permalink
Fix error handling the case where a cookie is not parseable ... in ne…
Browse files Browse the repository at this point in the history
…eds to be removed from the array.
  • Loading branch information
rfm committed Dec 23, 2024
1 parent 34112fa commit e7716e6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Source/NSHTTPCookie.m
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ + (NSMutableArray *) _parseField: (NSString *)field
dates and also could have tokens without values. */
while (count-- > 0)
{
NSHTTPCookie *cookie;
NSHTTPCookie *cookie = nil;
NSMutableDictionary *dict;
NSString *onecookie = [cookies objectAtIndex: count];

Expand All @@ -181,14 +181,14 @@ + (NSMutableArray *) _parseField: (NSString *)field
[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;
Expand Down

0 comments on commit e7716e6

Please sign in to comment.