]> khamidou — GitHub mirrors - electron.git/commitdiff
check for renderviewhost availability before using
authordeepak1556 <hop2deep@gmail.com>
Sat, 9 May 2015 12:17:40 +0000 (17:47 +0530)
committerdeepak1556 <hop2deep@gmail.com>
Thu, 21 May 2015 04:46:10 +0000 (10:16 +0530)
atom/browser/api/atom_api_web_contents.cc
atom/browser/api/atom_api_web_contents.h

index 2bd496ffce7492909fb1ae1050f8f6320af31109..02aa76fe6a040bbfa3172a8b70ca250fe616a304 100644 (file)
@@ -215,20 +215,26 @@ void WebContents::HandleKeyboardEvent(
       web_contents(), event);
 }
 
-void WebContents::EnterFullscreenModeForTab(content::WebContents* web_contents,
+void WebContents::EnterFullscreenModeForTab(content::WebContents* source,
                                             const GURL& origin) {
-  GetWindowFromGuest(web_contents)->SetFullScreen(true);
-  web_contents->GetRenderViewHost()->WasResized();
+  auto window = GetWindowFromGuest(source);
+  if (window) {
+    window->SetFullScreen(true);
+    source->GetRenderViewHost()->WasResized();
+  }
 }
 
-void WebContents::ExitFullscreenModeForTab(content::WebContents* web_contents) {
-  GetWindowFromGuest(web_contents)->SetFullScreen(false);
-  web_contents->GetRenderViewHost()->WasResized();
+void WebContents::ExitFullscreenModeForTab(content::WebContents* source) {
+  auto window = GetWindowFromGuest(source);
+  if (window) {
+    window->SetFullScreen(false);
+    source->GetRenderViewHost()->WasResized();
+  }
 }
 
 bool WebContents::IsFullscreenForTabOrPending(
-    const content::WebContents* web_contents) const {
-  auto window = GetWindowFromGuest(web_contents);
+    const content::WebContents* source) const {
+  auto window = GetWindowFromGuest(source);
   if (window)
     return window->IsFullscreen();
   else
index 5e9a93e3b5c2a16f14e44abaf5e3efc550d64ab1..e1979a6dc5f2b62eba4985608d584731a424ba6f 100644 (file)
@@ -151,11 +151,11 @@ class WebContents : public mate::EventEmitter,
   void HandleKeyboardEvent(
       content::WebContents* source,
       const content::NativeWebKeyboardEvent& event) override;
-  void EnterFullscreenModeForTab(content::WebContents* web_contents,
+  void EnterFullscreenModeForTab(content::WebContents* source,
                                  const GURL& origin) override;
-  void ExitFullscreenModeForTab(content::WebContents* web_contents) override;
+  void ExitFullscreenModeForTab(content::WebContents* source) override;
   bool IsFullscreenForTabOrPending(
-      const content::WebContents* web_contents) const override;
+      const content::WebContents* source) const override;
 
   // content::WebContentsObserver:
   void RenderViewDeleted(content::RenderViewHost*) override;