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
|
// We have to call it right after LoadURL because the RenderViewHost is only
|
||||||
// created after loading a page.
|
// created after loading a page.
|
||||||
const auto view = web_contents()->GetRenderWidgetHostView();
|
const auto view = web_contents()->GetRenderWidgetHostView();
|
||||||
|
if (view) {
|
||||||
WebContentsPreferences* web_preferences =
|
WebContentsPreferences* web_preferences =
|
||||||
WebContentsPreferences::FromWebContents(web_contents());
|
WebContentsPreferences::FromWebContents(web_contents());
|
||||||
std::string color_name;
|
std::string color_name;
|
||||||
|
@ -910,6 +911,7 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
|
||||||
view->SetBackgroundColor(SK_ColorTRANSPARENT);
|
view->SetBackgroundColor(SK_ColorTRANSPARENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WebContents::DownloadURL(const GURL& url) {
|
void WebContents::DownloadURL(const GURL& url) {
|
||||||
auto browser_context = web_contents()->GetBrowserContext();
|
auto browser_context = web_contents()->GetBrowserContext();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue