Don't create the ShaderEffect node when attributes are missing
authorGunnar Sletta <gunnar.sletta@nokia.com>
Tue, 30 Aug 2011 06:48:36 +0000 (08:48 +0200)
committerKim M. Kalland <kim.kalland@nokia.com>
Tue, 30 Aug 2011 08:41:55 +0000 (10:41 +0200)
Change-Id: Ib291b9b3bbf2f421998e2c8d92e34fb88f53a5c7
Reviewed-on: http://codereview.qt.nokia.com/3848
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
src/declarative/items/qsgshadereffect.cpp

index b66f9c1..ff13150 100644 (file)
@@ -582,6 +582,13 @@ QSGNode *QSGShaderEffect::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
 {
     QSGShaderEffectNode *node = static_cast<QSGShaderEffectNode *>(oldNode);
 
+    // In the case of a bad vertex shader, don't try to create a node...
+    if (m_source.attributeNames.isEmpty()) {
+        if (node)
+            delete node;
+        return 0;
+    }
+
     if (!node) {
         node = new QSGShaderEffectNode;
         m_programDirty = true;