opengl: Do not crash when programGuard is a nullptr

The rest of the code is checking programGuard for nullptr, do it here
as well to prevent a segmentation fault.

Change-Id: I38a03f74d493b8f731157be1739707b39904f7ba
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
Holger Hans Peter Freyther 2011-11-19 20:57:14 +01:00 committed by Qt by Nokia
parent 89aee9ecde
commit f1a67c6531
2 changed files with 2 additions and 2 deletions

View File

@ -936,7 +936,7 @@ void QOpenGLShaderProgram::release()
{
Q_D(QOpenGLShaderProgram);
#ifndef QT_NO_DEBUG
if (d->programGuard->group() != QOpenGLContextGroup::currentContextGroup())
if (d->programGuard && d->programGuard->group() != QOpenGLContextGroup::currentContextGroup())
qWarning("QOpenGLShaderProgram::release: program is not valid in the current context.");
#endif
d->glfuncs->glUseProgram(0);

View File

@ -980,7 +980,7 @@ void QGLShaderProgram::release()
{
#ifndef QT_NO_DEBUG
Q_D(QGLShaderProgram);
if (d->programGuard->group() != QOpenGLContextGroup::currentContextGroup())
if (d->programGuard && d->programGuard->group() != QOpenGLContextGroup::currentContextGroup())
qWarning("QGLShaderProgram::release: program is not valid in the current context.");
#endif
#if defined(QT_OPENGL_ES_2)