From fb13db8e1a9203874497147dd893ca6645928c5a Mon Sep 17 00:00:00 2001 From: Tom Burgin Date: Wed, 3 Aug 2016 12:48:29 -0400 Subject: [PATCH] serverRoots setters nil check (#4) --- Source/MOLAuthenticatingURLSession.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/MOLAuthenticatingURLSession.m b/Source/MOLAuthenticatingURLSession.m index adfeb2f..740764f 100644 --- a/Source/MOLAuthenticatingURLSession.m +++ b/Source/MOLAuthenticatingURLSession.m @@ -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 @@ -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];