diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp
index fc33f8f1f8f1d2767b40dbb662d0710aad45dfbf..2278fd25ba3a199060823d66cb0f61e836bea34b 100644
--- a/src/quick/util/qquickpath.cpp
+++ b/src/quick/util/qquickpath.cpp
@@ -1546,7 +1546,7 @@ void QQuickPathCatmullRomCurve::addToPath(QPainterPath &path, const QQuickPathDa
         nextData.curves = data.curves;
         next = positionForCurve(nextData, point);
     } else {
-        if (point == QPointF(path.elementAt(0)) && qobject_cast<QQuickPathCatmullRomCurve*>(data.curves.at(0))) {
+        if (point == QPointF(path.elementAt(0)) && qobject_cast<QQuickPathCatmullRomCurve*>(data.curves.at(0)) && path.elementCount() >= 3) {
             //this is a closed path starting and ending with catmull-rom segments.
             //we try to smooth the join point
             next = QPointF(path.elementAt(3));  //the first catmull-rom point