From: Cheng Zhao Date: Mon, 10 Mar 2014 01:24:51 +0000 (+0800) Subject: Fixes crash caused by NativeWindow::IsWebViewFocused. X-Git-Tag: v0.10.7~4 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=337e9f9553defb163fb1bb1d620bb42f914a9b52;p=electron.git Fixes crash caused by NativeWindow::IsWebViewFocused. The RenderViewHostView could be NULL when the renderer process has crashed. Fixes #206. --- diff --git a/browser/native_window.cc b/browser/native_window.cc index e1f061d7..bff1c2f3 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) {