fix: ensure owner window valid (#27948)

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot]
2021-03-04 16:39:08 +09:00
committed by GitHub
parent e5eafc8ee9
commit e262b5040a

View File

@@ -1105,7 +1105,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());
}