Skip to content

Commit 61eaafd

Browse files
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 8f9166d) Reviewed-by: Michal Klocek <[email protected]>
1 parent b61bb65 commit 61eaafd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/core/web_contents_view_qt.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,11 @@ void WebContentsViewQt::RenderViewCreated(content::RenderViewHost* host)
8888
{
8989
// The render process is done creating the RenderView and it's ready to be routed
9090
// messages at this point.
91-
if (m_client)
92-
host->GetView()->SetBackgroundColor(toSk(m_client->backgroundColor()));
91+
if (m_client && host) {
92+
content::RenderWidgetHostView* rwhv = host->GetView();
93+
if (rwhv)
94+
rwhv->SetBackgroundColor(toSk(m_client->backgroundColor()));
95+
}
9396
}
9497

9598
void WebContentsViewQt::CreateView(const gfx::Size& initial_size, gfx::NativeView context)

0 commit comments

Comments
 (0)