diff options
author | Marco Bubke <marco.bubke@nokia.com> | 2010-01-06 12:41:10 (GMT) |
---|---|---|
committer | Marco Bubke <marco.bubke@nokia.com> | 2010-01-06 12:51:13 (GMT) |
commit | 67b5fe0afbf7d32f845261690faa6b8554a2e308 (patch) | |
tree | 67b85cffc1e08c429c909f5538892e18c87a10f6 /src/declarative/graphicsitems | |
parent | 51b7c1eff019b73a5eb47c437be37606e4e185bf (diff) | |
download | Qt-67b5fe0afbf7d32f845261690faa6b8554a2e308.zip Qt-67b5fe0afbf7d32f845261690faa6b8554a2e308.tar.gz Qt-67b5fe0afbf7d32f845261690faa6b8554a2e308.tar.bz2 |
Check if the property is cached in QmlGraphicsVisualDataModel::stringValue
This fixes a Bauhaus crash.
Task-number: BAUHAUS-227
Reviewed-by: Kai Koehne
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp index b482db7..5b80ee0 100644 --- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp @@ -908,14 +908,18 @@ QString QmlGraphicsVisualDataModel::stringValue(int index, const QString &name) QmlDeclarativeData *ddata = QmlDeclarativeData::get(data); if (ddata && ddata->propertyCache) { QmlPropertyCache::Data *prop = ddata->propertyCache->property(name); - if (prop->propType == QVariant::String) { - void *args[] = { &val, 0 }; - QMetaObject::metacall(data, QMetaObject::ReadProperty, prop->coreIndex, args); - } else if (prop->propType == qMetaTypeId<QVariant>()) { - QVariant v; - void *args[] = { &v, 0 }; - QMetaObject::metacall(data, QMetaObject::ReadProperty, prop->coreIndex, args); - val = v.toString(); + if (prop) { + if (prop->propType == QVariant::String) { + void *args[] = { &val, 0 }; + QMetaObject::metacall(data, QMetaObject::ReadProperty, prop->coreIndex, args); + } else if (prop->propType == qMetaTypeId<QVariant>()) { + QVariant v; + void *args[] = { &v, 0 }; + QMetaObject::metacall(data, QMetaObject::ReadProperty, prop->coreIndex, args); + val = v.toString(); + } + } else { + val = data->property(name.toUtf8()).toString(); } } else { val = data->property(name.toUtf8()).toString(); |