]> khamidou — GitHub mirrors - electron.git/commitdiff
Fixes crash caused by NativeWindow::IsWebViewFocused.
authorCheng Zhao <zcbenz@gmail.com>
Mon, 10 Mar 2014 01:24:51 +0000 (09:24 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 10 Mar 2014 01:24:51 +0000 (09:24 +0800)
The RenderViewHostView could be NULL when the renderer process has
crashed.

Fixes #206.

browser/native_window.cc

index e1f061d7955f8d1920f0625901bf0b4d50d0b930..bff1c2f3c77774d2b9a1367e093b140f81c72e35 100644 (file)
@@ -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) {