Skip to content

Commit

Permalink
serverRoots setters nil check (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
tburgin authored and russellhancox committed Aug 3, 2016
1 parent baa2043 commit fb13db8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Source/MOLAuthenticatingURLSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ - (void)setUserAgent:(NSString *)userAgent {
#pragma mark Server Roots properties

- (void)setServerRootsPemFile:(NSString *)serverRootsPemFile {
if (!serverRootsPemFile) {
_serverRootsPemFile = nil;
return;
}
NSError *error;
NSData *rootsData = [NSData dataWithContentsOfFile:serverRootsPemFile
options:0
Expand All @@ -75,6 +79,10 @@ - (void)setServerRootsPemFile:(NSString *)serverRootsPemFile {
}

- (void)setServerRootsPemData:(NSData *)serverRootsPemData {
if (!serverRootsPemData) {
_serverRootsPemData = nil;
return;
}
NSString *pemStrings = [[NSString alloc] initWithData:serverRootsPemData
encoding:NSASCIIStringEncoding];
NSArray *certs = [MOLCertificate certificatesFromPEM:pemStrings];
Expand Down

0 comments on commit fb13db8

Please sign in to comment.