From e528029345b28fff14bfd9975b41b7a3d686d63a Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Wed, 29 Jan 2020 16:55:27 -0800 Subject: [PATCH] fix: ensure web_contents is not nullptr in UpdateDraggableRegions (#21955) * fix: ensure web_contents is not nullptr in UpdateDraggableRegions This is a speculative fix for a crash in `UpdateDraggableRegions` that we've noticed * Update atom_api_browser_window_mac.mm * Update atom_api_browser_window_mac.mm --- shell/browser/api/atom_api_browser_window_mac.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shell/browser/api/atom_api_browser_window_mac.mm b/shell/browser/api/atom_api_browser_window_mac.mm index 8d0108d2f2..378cb5d6cd 100644 --- a/shell/browser/api/atom_api_browser_window_mac.mm +++ b/shell/browser/api/atom_api_browser_window_mac.mm @@ -79,6 +79,9 @@ void BrowserWindow::UpdateDraggableRegions( if (window_->has_frame()) return; + if (!web_contents()) + return; + // All ControlRegionViews should be added as children of the WebContentsView, // because WebContentsView will be removed and re-added when entering and // leaving fullscreen mode.