]> khamidou — GitHub mirrors - electron.git/commitdiff
Fix crash when passing empty path to addRecentDocument
authorCheng Zhao <zcbenz@gmail.com>
Tue, 15 Dec 2015 09:17:24 +0000 (17:17 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 15 Dec 2015 09:17:24 +0000 (17:17 +0800)
atom/browser/browser_mac.mm

index 6589057c2c6ca54040321273b7967093c774a70d..6a3481cf06120a09c37e5e32f6d62398ba298cfe 100644 (file)
@@ -19,7 +19,12 @@ void Browser::Focus() {
 }
 
 void Browser::AddRecentDocument(const base::FilePath& path) {
-  NSURL* u = [NSURL fileURLWithPath:base::mac::FilePathToNSString(path)];
+  NSString* path_string = base::mac::FilePathToNSString(path);
+  if (!path_string)
+    return;
+  NSURL* u = [NSURL fileURLWithPath:path_string];
+  if (!u)
+    return;
   [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:u];
 }