]> khamidou — GitHub mirrors - electron.git/commitdiff
Fix a crash issue in GetProcessOwner if no renderer view host is found.
authorHaojian Wu <hokein.wu@gmail.com>
Thu, 6 Aug 2015 07:03:04 +0000 (15:03 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 11 Aug 2015 01:48:55 +0000 (09:48 +0800)
atom/browser/atom_browser_client.cc

index 65fd7cd031dd50f765a2ed1325faa9d05586a2ca..9a3ad00fa4cd64856d4682b6094e107c21880f18 100644 (file)
@@ -58,11 +58,15 @@ enum ProcessOwner {
   OWNER_GUEST_WEB_CONTENTS,
   OWNER_NONE,  // it might be devtools though.
 };
+
 ProcessOwner GetProcessOwner(int process_id,
                              NativeWindow** window,
                              WebViewManager::WebViewInfo* info) {
-  auto web_contents = content::WebContents::FromRenderViewHost(
-      content::RenderViewHost::FromID(process_id, kDefaultRoutingID));
+  content::RenderViewHost* rvh = content::RenderViewHost::FromID(
+      process_id, kDefaultRoutingID);
+  if (!rvh)
+    return OWNER_NONE;
+  auto web_contents = content::WebContents::FromRenderViewHost(rvh);
   if (!web_contents)
     return OWNER_NONE;