From 49b828102626ba6faa38ea48d9f570283dd7fa9f Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 9 Jul 2010 15:35:38 +1000 Subject: Fix crash with invalid role indexes --- src/declarative/util/qdeclarativelistmodel.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index deb835d..3ede335 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -1022,6 +1022,8 @@ QVariant NestedListModel::data(int index, int role) const Q_ASSERT(_root && index >= 0 && index < _root->values.count()); checkRoles(); QVariant rv; + if (roleStrings.count() < role) + return rv; ModelNode *node = qvariant_cast(_root->values.at(index)); if (!node) -- cgit v0.12