Skip to content
Snippets Groups Projects
Commit bc6888dc authored by George Nachman's avatar George Nachman
Browse files

Fix a crash when one of application support or tilde expanding fails when...

Fix a crash when one of application support or tilde expanding fails when getting paths to ssh config files
parent e73a84be
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -190,12 +190,16 @@ static NSError *SCPFileError(NSString *description) {
- (NSArray *)configs {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *appSupport = [fileManager applicationSupportDirectory];
NSArray *paths = @[ [appSupport stringByAppendingPathExtension:@"iTerm/ssh_config"],
[@"~/.ssh/config" stringByExpandingTildeInPath],
NSArray *paths = @[ [appSupport stringByAppendingPathExtension:@"iTerm/ssh_config"] ?: @"",
[@"~/.ssh/config" stringByExpandingTildeInPath] ?: @"",
@"/etc/ssh/ssh_config",
@"/etc/ssh_config" ];
NSMutableArray *configs = [NSMutableArray array];
for (NSString *path in paths) {
if (path.length == 0) {
DLog(@"Zero length path in configs paths %@", paths);
continue;
}
if ([fileManager fileExistsAtPath:path]) {
NMSSHConfig *config = [NMSSHConfig configFromFile:path];
if (config) {
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment