From: Haojian Wu Date: Thu, 6 Aug 2015 07:03:04 +0000 (+0800) Subject: Fix a crash issue in GetProcessOwner if no renderer view host is found. X-Git-Tag: v0.31.0~2^2~45 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=28093a4d2d6b3eae728a1764f21fcdc8cb3db63e;p=electron.git Fix a crash issue in GetProcessOwner if no renderer view host is found. --- diff --git a/atom/browser/atom_browser_client.cc b/atom/browser/atom_browser_client.cc index 65fd7cd0..9a3ad00f 100644 --- a/atom/browser/atom_browser_client.cc +++ b/atom/browser/atom_browser_client.cc @@ -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;