diff --git a/atom/browser/api/atom_api_web_contents_view.cc b/atom/browser/api/atom_api_web_contents_view.cc index a96f4a9c8d6c..e0fb14d16d81 100644 --- a/atom/browser/api/atom_api_web_contents_view.cc +++ b/atom/browser/api/atom_api_web_contents_view.cc @@ -63,12 +63,15 @@ WebContentsView::WebContentsView(v8::Isolate* isolate, } WebContentsView::~WebContentsView() { - api_web_contents_->RemoveObserver(this); - api_web_contents_->DestroyWebContents(false /* async */); + if (api_web_contents_) { + api_web_contents_->RemoveObserver(this); + api_web_contents_->DestroyWebContents(false /* async */); + } } void WebContentsView::OnCloseContents() { - // TODO(zcbenz): WebContents is closed, report the event. + api_web_contents_ = nullptr; + web_contents_.Reset(); } // static