diff --git a/src/recentmodel.cpp b/src/recentmodel.cpp index c4c2d02fd8e41098b38c08330e543e4339c15030..9e9a70fdf39fd8a8db337a689dd402bb2d144b13 100644 --- a/src/recentmodel.cpp +++ b/src/recentmodel.cpp @@ -400,11 +400,16 @@ RecentModel::getIndex(Person *p) const QModelIndex RecentModel::getIndex(ContactMethod *cm) const { + // check if the CM is an item the RecentModel if (d_ptr->m_hCMsToNodes.contains(cm)) { if (auto node = d_ptr->m_hCMsToNodes.value(cm)) return index(node->m_Index, 0); } + // otherwise, its possible the CM is contained within a Person item + if (auto person = cm->contact()) + return getIndex(person); + return {}; }