fix: guard against missing native view (#30328)

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot]
2021-08-02 09:57:58 +09:00
committed by GitHub
parent 52d9bf41e6
commit d462204dce

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())