fix: crash on parent window close and focur/blur (#46580)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot] 2025-04-09 11:19:20 -05:00 committed by GitHub
parent b234733555
commit 28eb0e6f3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View file

@ -219,14 +219,14 @@ void BrowserWindow::CloseImmediately() {
}
void BrowserWindow::Focus() {
if (api_web_contents_->IsOffScreen())
if (api_web_contents_ && api_web_contents_->IsOffScreen())
FocusOnWebView();
else
BaseWindow::Focus();
}
void BrowserWindow::Blur() {
if (api_web_contents_->IsOffScreen())
if (api_web_contents_ && api_web_contents_->IsOffScreen())
BlurWebView();
else
BaseWindow::Blur();