Fix dereferencing nullptr
RenderWidgetHostView might not be available when the navigator fails to load a url.
This commit is contained in:
parent
edcea3e800
commit
54559f99a0
1 changed files with 10 additions and 8 deletions
|
@ -900,6 +900,7 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
|
|||
// We have to call it right after LoadURL because the RenderViewHost is only
|
||||
// created after loading a page.
|
||||
const auto view = web_contents()->GetRenderWidgetHostView();
|
||||
if (view) {
|
||||
WebContentsPreferences* web_preferences =
|
||||
WebContentsPreferences::FromWebContents(web_contents());
|
||||
std::string color_name;
|
||||
|
@ -909,6 +910,7 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
|
|||
} else {
|
||||
view->SetBackgroundColor(SK_ColorTRANSPARENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WebContents::DownloadURL(const GURL& url) {
|
||||
|
|
Loading…
Reference in a new issue