fix: prevent crash if BrowserView webContents was destroyed (#25112)

This commit is contained in:
Shelley Vohr 2020-08-25 20:04:13 -07:00 committed by GitHub
parent c97f8109c2
commit c8a0b2b71d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 32 deletions

View file

@ -1072,9 +1072,9 @@ void NativeWindowViews::AddBrowserView(NativeBrowserView* view) {
}
add_browser_view(view);
content_view()->AddChildView(
view->GetInspectableWebContentsView()->GetView());
if (view->GetInspectableWebContentsView())
content_view()->AddChildView(
view->GetInspectableWebContentsView()->GetView());
}
void NativeWindowViews::RemoveBrowserView(NativeBrowserView* view) {
@ -1085,8 +1085,9 @@ void NativeWindowViews::RemoveBrowserView(NativeBrowserView* view) {
return;
}
content_view()->RemoveChildView(
view->GetInspectableWebContentsView()->GetView());
if (view->GetInspectableWebContentsView())
content_view()->RemoveChildView(
view->GetInspectableWebContentsView()->GetView());
remove_browser_view(view);
}