fix(ModelEntry): Don't call `data` for roles that don't exist in the source model

This commit is contained in:
Alex Jbanca 2024-06-03 11:53:58 +03:00 committed by Alex Jbanca
parent f241928cc9
commit 6560f27d99
1 changed files with 4 additions and 1 deletions

View File

@ -319,7 +319,10 @@ void ModelEntry::cacheItem()
for(const auto& role : qAsConst(m_roles))
{
auto roleName = m_sourceModel->roleNames().key(role.toUtf8());
auto roleNames = m_sourceModel->roleNames().keys(role.toUtf8());
if (roleNames.isEmpty()) continue;
auto roleName = roleNames.first();
auto roleValue = m_index.data(roleName);
if(roleValue.canConvert<QAbstractItemModel*>())