Skip to content

Commit

Permalink
fix: handle nullish WebContentsView in UpdateDraggableRegions (#30558)
Browse files Browse the repository at this point in the history
* fix: handle nullish WebContentsView in UpdateDraggableRegions

* build: nogncheck on webcontentsimpl include

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
  • Loading branch information
trop[bot] and MarshallOfSound committed Aug 19, 2021
1 parent 33631b4 commit 87399cc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions shell/browser/api/electron_api_browser_window_views.cc
Expand Up @@ -4,6 +4,7 @@

#include "shell/browser/api/electron_api_browser_window.h"

#include "content/browser/web_contents/web_contents_impl.h" // nogncheck
#include "shell/browser/native_window_views.h"
#include "ui/aura/window.h"

Expand All @@ -17,8 +18,10 @@ void BrowserWindow::UpdateDraggableRegions(
return;

if (&draggable_regions_ != &regions) {
auto* nv = web_contents()->GetNativeView();
if (nv) {
auto* view =
static_cast<content::WebContentsImpl*>(web_contents())->GetView();
if (view) {
const gfx::NativeView nv = view->GetNativeView();
auto const offset = nv->GetBoundsInRootWindow();
auto snapped_regions = mojo::Clone(regions);
for (auto& snapped_region : snapped_regions) {
Expand Down

0 comments on commit 87399cc

Please sign in to comment.