diff --git a/shell/browser/api/electron_api_web_contents_view.cc b/shell/browser/api/electron_api_web_contents_view.cc index aabda22ff9dd..9fbc2e2b8e66 100644 --- a/shell/browser/api/electron_api_web_contents_view.cc +++ b/shell/browser/api/electron_api_web_contents_view.cc @@ -81,11 +81,14 @@ void WebContentsView::SetBackgroundColor(std::optional color) { } int WebContentsView::NonClientHitTest(const gfx::Point& point) { - gfx::Point local_point(point); - views::View::ConvertPointFromWidget(view(), &local_point); - SkRegion* region = api_web_contents_->draggable_region(); - if (region && region->contains(local_point.x(), local_point.y())) - return HTCAPTION; + if (api_web_contents_) { + gfx::Point local_point(point); + views::View::ConvertPointFromWidget(view(), &local_point); + SkRegion* region = api_web_contents_->draggable_region(); + if (region && region->contains(local_point.x(), local_point.y())) + return HTCAPTION; + } + return HTNOWHERE; }