From 8f9166df03234978e0048570d2992db669a47423 Mon Sep 17 00:00:00 2001 From: Viktor Engelmann Date: Mon, 2 Jan 2017 17:07:39 +0100 Subject: 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 --- src/core/web_contents_view_qt.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/core') 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) -- cgit v1.2.3