diff options
author | Viktor Engelmann <viktor.engelmann@qt.io> | 2017-01-02 17:07:39 +0100 |
---|---|---|
committer | Viktor Engelmann <viktor.engelmann@qt.io> | 2017-01-03 12:26:25 +0000 |
commit | 8f9166df03234978e0048570d2992db669a47423 (patch) | |
tree | ffcf9661650b77301eb5b5b09e387582f80cc86d /src/core/web_contents_view_qt.cpp | |
parent | cb83d3059112b6176b9602ec84acb31ad664860b (diff) |
Check RWHV for NULL before dereferencing it
Under exotic circumstances, the RenderWidgetHostView pointer returned
by m_webContents->GetRenderWidgetHostView() can be NULL. Therefore,
it must be tested for NULL, before its SetBackgroundColor method
is called.
Task-number: QTBUG-57826
Change-Id: I30e0d2174e80d7971f4e2b6f315a771dc1577814
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/web_contents_view_qt.cpp')
-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 ed6fdabff..0c4cf29d3 100644 --- a/src/core/web_contents_view_qt.cpp +++ b/src/core/web_contents_view_qt.cpp @@ -95,8 +95,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) - m_webContents->GetRenderWidgetHostView()->SetBackgroundColor(toSk(m_client->backgroundColor())); + if (m_client && m_webContents) { + content::RenderWidgetHostView* rwhv = m_webContents->GetRenderWidgetHostView(); + if (rwhv) + rwhv->SetBackgroundColor(toSk(m_client->backgroundColor())); + } } void WebContentsViewQt::CreateView(const gfx::Size& initial_size, gfx::NativeView context) |