From 9e604dcd07d5b943520ab2a3d472bd23fdd577ec Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Thu, 17 Jan 2013 18:46:45 +0900 Subject: Fix crash in PathView Change-Id: I259e7af1755ff9615782bbce03fc41ea1957cab3 Task-number: QTBUG-29176 Reviewed-by: Alan Alpert --- src/quick/items/qquickpathview.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index a58ed599be..a7be50bc11 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -193,7 +193,7 @@ void QQuickPathView::initItem(int index, QQuickItem *item) if (att) { att->m_view = this; qreal percent = d->positionOfIndex(index); - if (percent < 1.0) { + if (percent < 1.0 && d->path) { foreach (const QString &attr, d->path->attributes()) att->setValue(attr.toUtf8(), d->path->attributeAt(attr, percent)); item->setZ(d->requestedZ); @@ -227,8 +227,10 @@ QQmlOpenMetaObjectType *QQuickPathViewPrivate::attachedType() if (!attType) { // pre-create one metatype to share with all attached objects attType = new QQmlOpenMetaObjectType(&QQuickPathViewAttached::staticMetaObject, qmlEngine(q)); - foreach (const QString &attr, path->attributes()) - attType->createProperty(attr.toUtf8()); + if (path) { + foreach (const QString &attr, path->attributes()) + attType->createProperty(attr.toUtf8()); + } } return attType; @@ -423,6 +425,8 @@ void QQuickPathView::pathUpdated() void QQuickPathViewPrivate::updateItem(QQuickItem *item, qreal percent) { + if (!path) + return; if (QQuickPathViewAttached *att = attached(item)) { if (qFuzzyCompare(att->m_percent, percent)) return; -- cgit v1.2.3