diff options
author | Viktor Engelmann <viktor.engelmann@qt.io> | 2017-04-06 15:19:24 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-04-15 14:14:30 +0000 |
commit | f88200c6b44a5e68f7d9fabde9ac58c86728acb4 (patch) | |
tree | 300703b03f64c1010a41ed837c213359038755f2 /src/core/content_browser_client_qt.cpp | |
parent | fa94cb09e095a6d6c5634ae8543fc70145594c05 (diff) |
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: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/content_browser_client_qt.cpp')
-rw-r--r-- | src/core/content_browser_client_qt.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index b30c4dfa7..de6e29de6 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -447,8 +447,11 @@ content::MediaObserver *ContentBrowserClientQt::GetMediaObserver() void ContentBrowserClientQt::OverrideWebkitPrefs(content::RenderViewHost *rvh, content::WebPreferences *web_prefs) { - if (content::WebContents *webContents = rvh->GetDelegate()->GetAsWebContents()) - static_cast<WebContentsDelegateQt*>(webContents->GetDelegate())->overrideWebPreferences(webContents, web_prefs); + if (content::WebContents *webContents = rvh->GetDelegate()->GetAsWebContents()) { + WebContentsDelegateQt* delegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate()); + if (delegate) + delegate->overrideWebPreferences(webContents, web_prefs); + } } content::QuotaPermissionContext *ContentBrowserClientQt::CreateQuotaPermissionContext() |