From 6560f27d996a6b8a6526f07bb3eebbc35cf0cb11 Mon Sep 17 00:00:00 2001 From: Alex Jbanca Date: Mon, 3 Jun 2024 11:53:58 +0300 Subject: [PATCH] fix(ModelEntry): Don't call `data` for roles that don't exist in the source model --- ui/StatusQ/src/modelentry.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/StatusQ/src/modelentry.cpp b/ui/StatusQ/src/modelentry.cpp index 0f45566fde..d1b8f36cf7 100644 --- a/ui/StatusQ/src/modelentry.cpp +++ b/ui/StatusQ/src/modelentry.cpp @@ -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())