From 598cdea22aa4ad5d387feb6e4d8ec47a3ac173ce Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 29 Apr 2013 17:54:31 -0700 Subject: [PATCH] Don't crash when running dev with no resource path Previously if the --dev flag was used and no resource was specified or found in ~/github/atom then the app would crash trying to add a null resource path to the node paths list. Now the bundle resource path is the fallback whenever the dev resource path cannot be found or does not exist. --- native/atom_window_controller.mm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/native/atom_window_controller.mm b/native/atom_window_controller.mm index 01e4f594d..ec135f36b 100644 --- a/native/atom_window_controller.mm +++ b/native/atom_window_controller.mm @@ -34,10 +34,7 @@ AtomApplication *atomApplication = (AtomApplication *)[AtomApplication sharedApplication]; - if (useBundleResourcePath) { - _resourcePath = [[NSBundle bundleForClass:self.class] resourcePath]; - } - else { + if (!useBundleResourcePath) { _resourcePath = [[atomApplication.arguments objectForKey:@"resource-path"] stringByStandardizingPath]; if (!_resourcePath) { NSString *defaultRepositoryPath = [@"~/github/atom" stringByStandardizingPath]; @@ -48,11 +45,15 @@ _resourcePath = defaultRepositoryPath; } else { + _resourcePath = [[NSBundle bundleForClass:self.class] resourcePath]; NSLog(@"Warning: No resource path specified and no directory exists at ~/github/atom"); } } } } + if (!_resourcePath) { + _resourcePath = [[NSBundle bundleForClass:self.class] resourcePath]; + } if ([self isDevMode]) { [self displayDevIcon];