fix: guard against missing native view (#30304)
This commit is contained in:
parent
4aa9455613
commit
39c3ff5292
1 changed files with 9 additions and 7 deletions
|
@ -17,14 +17,16 @@ void BrowserWindow::UpdateDraggableRegions(
|
|||
return;
|
||||
|
||||
if (&draggable_regions_ != ®ions) {
|
||||
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())
|
||||
|
|
Loading…
Reference in a new issue