diff options
author | Viktor Engelmann <viktor.engelmann@qt.io> | 2017-01-02 17:07:39 +0100 |
---|---|---|
committer | Viktor Engelmann <viktor.engelmann@qt.io> | 2017-02-06 11:12:39 +0000 |
commit | 61eaafd1d9c224a70c7c337d4c028e1dfcf93c8e (patch) | |
tree | fca49e9e3deba0bb60c2d577e9277bd652a060a7 | |
parent | b61bb656ac1d332da300177b41c1331d1f672c47 (diff) |
Check RWHV for NULL before dereferencing it
Under exotic circumstances, the RenderWidgetHostView pointer returned
by host->GetView() can be NULL. Therefore, it must be tested for NULL,
before its SetBackgroundColor method is called.
Task-number: QTBUG-57826
Change-Id: Iaf3c91bdd5cb329751c29415d182bb144d01634e
(cherry picked from commit 8f9166df03234978e0048570d2992db669a47423)
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
-rw-r--r-- | src/core/web_contents_view_qt.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp index ae53619ac..3c5413d74 100644 --- a/src/core/web_contents_view_qt.cpp +++ b/src/core/web_contents_view_qt.cpp @@ -88,8 +88,11 @@ void WebContentsViewQt::RenderViewCreated(content::RenderViewHost* host) { // The render process is done creating the RenderView and it's ready to be routed // messages at this point. - if (m_client) - host->GetView()->SetBackgroundColor(toSk(m_client->backgroundColor())); + if (m_client && host) { + content::RenderWidgetHostView* rwhv = host->GetView(); + if (rwhv) + rwhv->SetBackgroundColor(toSk(m_client->backgroundColor())); + } } void WebContentsViewQt::CreateView(const gfx::Size& initial_size, gfx::NativeView context) |