diff options
author | Tasuku Suzuki <stasuku@gmail.com> | 2013-01-17 18:46:45 +0900 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-18 18:19:16 +0100 |
commit | 9e604dcd07d5b943520ab2a3d472bd23fdd577ec (patch) | |
tree | c627d6ff4f9b8ade492772f98ba4c0beacf6848a /src/quick/items/qquickpathview.cpp | |
parent | 0d17d4a19c07e475920dcb0d0c57a8717ba98844 (diff) |
Fix crash in PathView
Change-Id: I259e7af1755ff9615782bbce03fc41ea1957cab3
Task-number: QTBUG-29176
Reviewed-by: Alan Alpert <aalpert@rim.com>
Diffstat (limited to 'src/quick/items/qquickpathview.cpp')
-rw-r--r-- | src/quick/items/qquickpathview.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
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; |