Skip to content

Commit

Permalink
fix: crash when run from SMB network share (#17908)
Browse files Browse the repository at this point in the history
  • Loading branch information
trop[bot] authored and codebytere committed Apr 24, 2019
1 parent 7514372 commit f3a05c3
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions atom/browser/atom_browser_main_parts_mac.mm
Expand Up @@ -54,8 +54,26 @@
auto application = [principalClass sharedApplication];

NSString* mainNibName = [infoDictionary objectForKey:@"NSMainNibFile"];
auto mainNib = [[NSNib alloc] initWithNibNamed:mainNibName
bundle:base::mac::FrameworkBundle()];

NSNib* mainNib;

@try {
mainNib = [[NSNib alloc] initWithNibNamed:mainNibName
bundle:base::mac::FrameworkBundle()];
// Handle failure of initWithNibNamed on SMB shares
// TODO(codebytere): Remove when
// https://bugs.chromium.org/p/chromium/issues/detail?id=932935 is fixed
} @catch (NSException* exception) {
NSString* nibPath =
[NSString stringWithFormat:@"Resources/%@.nib", mainNibName];
nibPath = [base::mac::FrameworkBundle().bundlePath
stringByAppendingPathComponent:nibPath];

NSData* data = [NSData dataWithContentsOfFile:nibPath];
mainNib = [[NSNib alloc] initWithNibData:data
bundle:base::mac::FrameworkBundle()];
}

[mainNib instantiateWithOwner:application topLevelObjects:nil];
[mainNib release];
}
Expand Down

0 comments on commit f3a05c3

Please sign in to comment.