fix: guard against missing native view (#30304)

This commit is contained in:
Shelley Vohr 2021-07-29 23:27:02 +02:00 committed by GitHub
parent 4aa9455613
commit 39c3ff5292
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,14 +17,16 @@ void BrowserWindow::UpdateDraggableRegions(
return;
if (&draggable_regions_ != &regions) {
auto const offset =
web_contents()->GetNativeView()->GetBoundsInRootWindow();
auto snapped_regions = mojo::Clone(regions);
for (auto& snapped_region : snapped_regions) {
snapped_region->bounds.Offset(offset.x(), offset.y());
}
auto* nv = web_contents()->GetNativeView();
if (nv) {
auto const offset = nv->GetBoundsInRootWindow();
auto snapped_regions = mojo::Clone(regions);
for (auto& snapped_region : snapped_regions) {
snapped_region->bounds.Offset(offset.x(), offset.y());
}
draggable_regions_ = mojo::Clone(snapped_regions);
draggable_regions_ = mojo::Clone(snapped_regions);
}
}
static_cast<NativeWindowViews*>(window_.get())