diff options
-rw-r--r-- | src/qml/types/qqmllistmodel.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 5e06455b26..cc4ccbaeb1 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -1267,10 +1267,12 @@ void ModelNodeMetaObject::updateValues() { const int roleCount = m_model->m_listModel->roleCount(); if (!m_initialized) { - int *changedRoles = reinterpret_cast<int *>(alloca(roleCount * sizeof(int))); - for (int i = 0; i < roleCount; ++i) - changedRoles[i] = i; - emitDirectNotifies(changedRoles, roleCount); + if (roleCount) { + int *changedRoles = reinterpret_cast<int *>(alloca(roleCount * sizeof(int))); + for (int i = 0; i < roleCount; ++i) + changedRoles[i] = i; + emitDirectNotifies(changedRoles, roleCount); + } return; } for (int i=0 ; i < roleCount ; ++i) { |