Commit f88200c6 authored by Viktor Engelmann's avatar Viktor Engelmann Committed by Allan Sandfeld Jensen
Browse files

Add two nullpointer checks


The two nullpointer checks prevent crashes that happened when one
clicked on a link with target="_blank" in 56-based.

Task-number: QTBUG-46713
Change-Id: I1f8a20a52726ab05a85dbca2ec49784985384d06
Reviewed-by: default avatarAllan Sandfeld Jensen <allan.jensen@qt.io>
Showing with 9 additions and 4 deletions
...@@ -447,8 +447,11 @@ content::MediaObserver *ContentBrowserClientQt::GetMediaObserver() ...@@ -447,8 +447,11 @@ content::MediaObserver *ContentBrowserClientQt::GetMediaObserver()
void ContentBrowserClientQt::OverrideWebkitPrefs(content::RenderViewHost *rvh, content::WebPreferences *web_prefs) void ContentBrowserClientQt::OverrideWebkitPrefs(content::RenderViewHost *rvh, content::WebPreferences *web_prefs)
{ {
if (content::WebContents *webContents = rvh->GetDelegate()->GetAsWebContents()) if (content::WebContents *webContents = rvh->GetDelegate()->GetAsWebContents()) {
static_cast<WebContentsDelegateQt*>(webContents->GetDelegate())->overrideWebPreferences(webContents, web_prefs); WebContentsDelegateQt* delegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate());
if (delegate)
delegate->overrideWebPreferences(webContents, web_prefs);
}
} }
content::QuotaPermissionContext *ContentBrowserClientQt::CreateQuotaPermissionContext() content::QuotaPermissionContext *ContentBrowserClientQt::CreateQuotaPermissionContext()
......
...@@ -118,8 +118,10 @@ gfx::NativeView WebContentsViewQt::GetNativeView() const ...@@ -118,8 +118,10 @@ gfx::NativeView WebContentsViewQt::GetNativeView() const
void WebContentsViewQt::GetContainerBounds(gfx::Rect* out) const void WebContentsViewQt::GetContainerBounds(gfx::Rect* out) const
{ {
const QRectF r(m_client->viewportRect()); if (m_client) {
*out = gfx::Rect(r.x(), r.y(), r.width(), r.height()); const QRectF r(m_client->viewportRect());
*out = gfx::Rect(r.x(), r.y(), r.width(), r.height());
}
} }
void WebContentsViewQt::Focus() void WebContentsViewQt::Focus()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment