fix: ensure owner window valid (#27786)

This commit is contained in:
Shelley Vohr 2021-03-01 21:26:23 +00:00 committed by GitHub
parent c30484ce13
commit e5a9a1ebd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1118,7 +1118,7 @@ void BaseWindow::ResetBrowserViews() {
// reset if the owner window is *this* window.
if (browser_view->web_contents()) {
auto* owner_window = browser_view->web_contents()->owner_window();
if (owner_window == window_.get()) {
if (owner_window && owner_window == window_.get()) {
browser_view->web_contents()->SetOwnerWindow(nullptr);
owner_window->RemoveBrowserView(browser_view->view());
}