diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-03-19 07:34:30 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-03-19 07:34:30 (GMT) |
commit | 55ffc0f27638485803f29d985a57deb5b3db4584 (patch) | |
tree | 4c5fccfa52eb5be6808193a9ba686a804eac59f4 /src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | |
parent | fd520c032eabab22acfabe9ffdc5929e168a279f (diff) | |
download | Qt-55ffc0f27638485803f29d985a57deb5b3db4584.zip Qt-55ffc0f27638485803f29d985a57deb5b3db4584.tar.gz Qt-55ffc0f27638485803f29d985a57deb5b3db4584.tar.bz2 |
Don't crash if an out of bounds model index is accessed.
Task-number: QTBUG-9184
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 6341764..b31bbd0 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -422,6 +422,8 @@ int QDeclarativeVisualDataModelDataMetaObject::createProperty(const char *name, return -1; QDeclarativeVisualDataModelPrivate *model = QDeclarativeVisualDataModelPrivate::get(data->m_model); + if (data->m_index < 0 || data->m_index >= model->modelCount()) + return -1; if ((!model->m_listModelInterface || !model->m_abstractItemModel) && model->m_listAccessor) { if (model->m_listAccessor->type() == QDeclarativeListAccessor::ListProperty) { |