From 337e9f9553defb163fb1bb1d620bb42f914a9b52 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 10 Mar 2014 09:24:51 +0800 Subject: [PATCH] Fixes crash caused by NativeWindow::IsWebViewFocused. The RenderViewHostView could be NULL when the renderer process has crashed. Fixes #206. --- browser/native_window.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/browser/native_window.cc b/browser/native_window.cc index e1f061d7955..bff1c2f3c77 100644 --- a/browser/native_window.cc +++ b/browser/native_window.cc @@ -231,7 +231,9 @@ void NativeWindow::BlurWebView() { } bool NativeWindow::IsWebViewFocused() { - return GetWebContents()->GetRenderViewHost()->GetView()->HasFocus(); + content::RenderWidgetHostView* host_view = + GetWebContents()->GetRenderViewHost()->GetView(); + return host_view && host_view->HasFocus(); } bool NativeWindow::SetIcon(const std::string& str_path) {