fix: crash when run from SMB network share (#17886)
This commit is contained in:
parent
e9114b3c00
commit
316abe21f9
1 changed files with 20 additions and 2 deletions
|
@ -41,8 +41,26 @@ void AtomBrowserMainParts::InitializeMainNib() {
|
||||||
auto application = [principalClass sharedApplication];
|
auto application = [principalClass sharedApplication];
|
||||||
|
|
||||||
NSString* mainNibName = [infoDictionary objectForKey:@"NSMainNibFile"];
|
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 instantiateWithOwner:application topLevelObjects:nil];
|
||||||
[mainNib release];
|
[mainNib release];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue