Checking whether the m_textTexture is not null before dereferencing it

Summary:
It can be null even after updateTextTexture() if there is not text
to generate the texture from:

        if (m_effectFrame->text().isEmpty())
            return;

Reviewers: graesslin

Reviewed By: graesslin

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1347
This commit is contained in:
Ivan Čukić 2016-04-08 09:26:12 +02:00
parent 2c95a4e6b9
commit f06dff3390
2 changed files with 12 additions and 6 deletions

View file

@ -2099,9 +2099,12 @@ void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double fra
}
if (!m_textTexture) // Lazy creation
updateTextTexture();
m_textTexture->bind();
m_textTexture->render(region, m_effectFrame->geometry());
m_textTexture->unbind();
if (m_textTexture) {
m_textTexture->bind();
m_textTexture->render(region, m_effectFrame->geometry());
m_textTexture->unbind();
}
}
if (shader) {

View file

@ -926,9 +926,12 @@ void SceneXrender::EffectFrame::render(QRegion region, double opacity, double fr
if (!m_textPicture) { // Lazy creation
updateTextPicture();
}
xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, *m_textPicture, fill, effects->xrenderBufferPicture(),
0, 0, 0, 0, m_effectFrame->geometry().x(), m_effectFrame->geometry().y(),
m_effectFrame->geometry().width(), m_effectFrame->geometry().height());
if (m_textPicture) {
xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, *m_textPicture, fill, effects->xrenderBufferPicture(),
0, 0, 0, 0, m_effectFrame->geometry().x(), m_effectFrame->geometry().y(),
m_effectFrame->geometry().width(), m_effectFrame->geometry().height());
}
}
}