From 836c13b33089f53b149df36eba066f3fb52be711 Mon Sep 17 00:00:00 2001 From: Robo Date: Thu, 17 Dec 2015 23:27:05 +0530 Subject: [PATCH] browser: check for rvh existence --- atom/browser/atom_browser_client.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/atom/browser/atom_browser_client.cc b/atom/browser/atom_browser_client.cc index 1303b91b04d2..627d616cd6f2 100644 --- a/atom/browser/atom_browser_client.cc +++ b/atom/browser/atom_browser_client.cc @@ -197,9 +197,16 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches( if (ContainsKey(pending_processes_, process_id)) process_id = pending_processes_[process_id]; + + // Certain render process will be created with no associated render view, + // for example: ServiceWorker. + auto rvh = content::RenderViewHost::FromID(process_id, kDefaultRoutingID); + if (!rvh) + return; + // Get the WebContents of the render process. - content::WebContents* web_contents = content::WebContents::FromRenderViewHost( - content::RenderViewHost::FromID(process_id, kDefaultRoutingID)); + content::WebContents* web_contents = + content::WebContents::FromRenderViewHost(rvh); if (!web_contents) return;