Return early in AFGetMediaTypeAndSubtypeWithString if string is nil
This commit is contained in:
parent
2528a0e673
commit
d1b7ff8f3c
1 changed files with 4 additions and 0 deletions
|
|
@ -58,6 +58,10 @@ NSSet * AFContentTypesFromHTTPHeader(NSString *string) {
|
|||
}
|
||||
|
||||
static void AFGetMediaTypeAndSubtypeWithString(NSString *string, NSString **type, NSString **subtype) {
|
||||
if (!string) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSScanner *scanner = [NSScanner scannerWithString:string];
|
||||
[scanner setCharactersToBeSkipped:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
[scanner scanUpToString:@"/" intoString:type];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue