diff options
author | Yann Bodson <yann.bodson@nokia.com> | 2010-01-29 03:01:49 (GMT) |
---|---|---|
committer | Yann Bodson <yann.bodson@nokia.com> | 2010-01-29 03:01:49 (GMT) |
commit | 5cf8677758e6fbfa5bf360c73519c14630db808c (patch) | |
tree | b92c5b97561ef875c08397bb8b4b925007f557a6 /src/declarative/util/qmllistmodel.cpp | |
parent | b91871a108638a5a136ac2a4310f5a3743320f72 (diff) | |
parent | 430f3ba46d3db10f7b4534f74e65d2ca13b23747 (diff) | |
download | Qt-5cf8677758e6fbfa5bf360c73519c14630db808c.zip Qt-5cf8677758e6fbfa5bf360c73519c14630db808c.tar.gz Qt-5cf8677758e6fbfa5bf360c73519c14630db808c.tar.bz2 |
Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/util/qmllistmodel.cpp')
-rw-r--r-- | src/declarative/util/qmllistmodel.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp index e975a5f..8c70539 100644 --- a/src/declarative/util/qmllistmodel.cpp +++ b/src/declarative/util/qmllistmodel.cpp @@ -405,7 +405,7 @@ QHash<int,QVariant> QmlListModel::data(int index, const QList<int> &roles) const { checkRoles(); QHash<int, QVariant> rv; - if (index >= count()) + if (index >= count() || index < 0) return rv; ModelNode *node = qvariant_cast<ModelNode *>(_root->values.at(index)); @@ -430,7 +430,7 @@ QVariant QmlListModel::data(int index, int role) const { checkRoles(); QVariant rv; - if (index >= count()) + if (index >= count() || index < 0) return rv; ModelNode *node = qvariant_cast<ModelNode *>(_root->values.at(index)); @@ -643,7 +643,7 @@ void QmlListModel::append(const QScriptValue& valuemap) */ QScriptValue QmlListModel::get(int index) const { - if (index >= count()) { + if (index >= count() || index < 0) { qmlInfo(this) << tr("get: index %1 out of range").arg(index); return 0; } @@ -680,7 +680,7 @@ void QmlListModel::set(int index, const QScriptValue& valuemap) qmlInfo(this) << tr("set: value is not an object"); return; } - if ( !_root || index > _root->values.count()) { + if ( !_root || index > _root->values.count() || index < 0) { qmlInfo(this) << tr("set: index %1 out of range").arg(index); return; } @@ -719,7 +719,7 @@ void QmlListModel::set(int index, const QScriptValue& valuemap) */ void QmlListModel::setProperty(int index, const QString& property, const QVariant& value) { - if ( !_root || index >= _root->values.count()) { + if ( !_root || index >= _root->values.count() || index < 0) { qmlInfo(this) << tr("set: index %1 out of range").arg(index); return; } |