summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesus Fernandez <jesus.fernandez@qt.io>2017-06-25 10:37:49 +0200
committerJesus Fernandez <Jesus.Fernandez@qt.io>2017-06-26 08:17:51 +0000
commit21fd17d7c1fca77e802ba2d3fd5aeebcdef157e4 (patch)
treefcdafbedb0ec0e2e53bcfd4a3571b41c26dd232c
parent31611f32bb89564dc6933d47eeb4ca4e45ac5563 (diff)
Add Q_ASSERT to test prevNode
To make Coverity happy: *** CID 181275: Null pointer dereferences (FORWARD_NULL) /qtdeclarative/src/imports/shapes/qquickshapegenericrenderer.cpp: 503 in QQuickShapeGenericRenderer::updateNode()() 497 QQuickShapeGenericNode **nodePtr = &m_rootNode; 498 QQuickShapeGenericNode *prevNode = nullptr; 499 500 for (ShapePathData &d : m_sp) { 501 if (!*nodePtr) { 502 *nodePtr = new QQuickShapeGenericNode; >>> CID 181275: Null pointer dereferences (FORWARD_NULL) >>> Dereferencing null pointer "prevNode". 503 prevNode->m_next = *nodePtr; 504 prevNode->appendChildNode(*nodePtr); 505 } 506 507 QQuickShapeGenericNode *node = *nodePtr; 508 Change-Id: I76e79ef6fe94aa8b0e77f79724101b4682dab6d3 Coverity-Id: 181275 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r--src/imports/shapes/qquickshapegenericrenderer.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/imports/shapes/qquickshapegenericrenderer.cpp b/src/imports/shapes/qquickshapegenericrenderer.cpp
index 47203698d5..4a4176793f 100644
--- a/src/imports/shapes/qquickshapegenericrenderer.cpp
+++ b/src/imports/shapes/qquickshapegenericrenderer.cpp
@@ -499,6 +499,7 @@ void QQuickShapeGenericRenderer::updateNode()
for (ShapePathData &d : m_sp) {
if (!*nodePtr) {
+ Q_ASSERT(prevNode);
*nodePtr = new QQuickShapeGenericNode;
prevNode->m_next = *nodePtr;
prevNode->appendChildNode(*nodePtr);