From 310509213007c4ae6b2341cb114a133367e41747 Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Mon, 15 Dec 2014 06:10:39 -0800 Subject: [PATCH] Fix nullref crash in RemoveGuest --- atom/browser/web_view/web_view_manager.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/atom/browser/web_view/web_view_manager.cc b/atom/browser/web_view/web_view_manager.cc index 032be04e7820..4a49bd442284 100644 --- a/atom/browser/web_view/web_view_manager.cc +++ b/atom/browser/web_view/web_view_manager.cc @@ -81,12 +81,16 @@ void WebViewManager::AddGuest(int guest_instance_id, void WebViewManager::RemoveGuest(int guest_instance_id) { auto web_contents = web_contents_map_[guest_instance_id].web_contents; - content::BrowserThread::PostTask( - content::BrowserThread::IO, FROM_HERE, - base::Bind( - &WebViewRendererState::RemoveGuest, - base::Unretained(WebViewRendererState::GetInstance()), - web_contents->GetRenderProcessHost()->GetID())); + + if (web_contents) { + content::BrowserThread::PostTask( + content::BrowserThread::IO, FROM_HERE, + base::Bind( + &WebViewRendererState::RemoveGuest, + base::Unretained(WebViewRendererState::GetInstance()), + web_contents->GetRenderProcessHost()->GetID())); + } + web_contents_map_.erase(guest_instance_id); // Remove the record of element in embedder too.