summaryrefslogtreecommitdiffstats
path: root/src/qml/util/qqmladaptormodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/util/qqmladaptormodel.cpp')
-rw-r--r--src/qml/util/qqmladaptormodel.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp
index a9a38c5381..1ff866eb74 100644
--- a/src/qml/util/qqmladaptormodel.cpp
+++ b/src/qml/util/qqmladaptormodel.cpp
@@ -162,8 +162,14 @@ public:
signalIndexes.append(propertyId + signalOffset);
}
- for (int i = 0, c = items.count(); i < c; ++i) {
- QQmlDelegateModelItem *item = items.at(i);
+ QVarLengthArray<QQmlGuard<QQmlDelegateModelItem>> guardedItems;
+ for (const auto item : items)
+ guardedItems.append(item);
+
+ for (const auto &item : qAsConst(guardedItems)) {
+ if (item.isNull())
+ continue;
+
const int idx = item->modelIndex();
if (idx >= index && idx < index + count) {
for (int i = 0; i < signalIndexes.count(); ++i)