Skip to content

Commit

Permalink
Added nil check to parameter of fileExistsAtPath:
Browse files Browse the repository at this point in the history
NSURL path can return nil, but fileExistsAtPath: can't accept nil, so the compiler was warning, even though this would never likely happen in practice. Added nil check.
  • Loading branch information
seanm committed Apr 26, 2019
1 parent d80766b commit 1384464
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Source/GCD/GCDAsyncSocket.m
Original file line number Diff line number Diff line change
Expand Up @@ -1864,8 +1864,9 @@ - (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr;

NSError *error = nil;
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:url.path]) {
if (![[NSFileManager defaultManager] removeItemAtURL:url error:&error]) {
NSString *urlPath = url.path;
if (urlPath && [fileManager fileExistsAtPath:urlPath]) {
if (![fileManager removeItemAtURL:url error:&error]) {
NSString *msg = @"Could not remove previous unix domain socket at given url.";
err = [self otherError:msg];

Expand Down

0 comments on commit 1384464

Please sign in to comment.