From d0962b1a93f8ddf4eff36292d37abbe403474a3f Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 15 Dec 2015 17:17:24 +0800 Subject: [PATCH] Fix crash when passing empty path to addRecentDocument --- atom/browser/browser_mac.mm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/atom/browser/browser_mac.mm b/atom/browser/browser_mac.mm index 6589057c2c6c..6a3481cf0612 100644 --- a/atom/browser/browser_mac.mm +++ b/atom/browser/browser_mac.mm @@ -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]; }