diff --git a/shell/browser/api/electron_api_browser_view.cc b/shell/browser/api/electron_api_browser_view.cc index ff5a42581445..7193c00fa1c5 100644 --- a/shell/browser/api/electron_api_browser_view.cc +++ b/shell/browser/api/electron_api_browser_view.cc @@ -155,11 +155,12 @@ gfx::Rect BrowserView::GetBounds() { } void BrowserView::SetBackgroundColor(const std::string& color_name) { - if (!web_contents()) - return; + view_->SetBackgroundColor(ParseHexColor(color_name)); - auto* wc = web_contents()->web_contents(); - wc->SetPageBaseBackgroundColor(ParseHexColor(color_name)); + if (web_contents()) { + auto* wc = web_contents()->web_contents(); + wc->SetPageBaseBackgroundColor(ParseHexColor(color_name)); + } } v8::Local BrowserView::GetWebContents(v8::Isolate* isolate) {