From 16851bdcc2f49750619dd59f77ea4bed9da1e144 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Fri, 9 Feb 2024 09:29:45 +0100 Subject: [PATCH] Fix crash on participant list. --- .../components/participant/ParticipantProxyModel.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/linphone-app/src/components/participant/ParticipantProxyModel.cpp b/linphone-app/src/components/participant/ParticipantProxyModel.cpp index 1a705692a..a89478c5b 100644 --- a/linphone-app/src/components/participant/ParticipantProxyModel.cpp +++ b/linphone-app/src/components/participant/ParticipantProxyModel.cpp @@ -208,9 +208,11 @@ bool ParticipantProxyModel::filterAcceptsRow (int sourceRow, const QModelIndex & } } -bool ParticipantProxyModel::lessThan (const QModelIndex &left, const QModelIndex &right) const { - const ParticipantModel* a = sourceModel()->data(left).value(); - const ParticipantModel* b = sourceModel()->data(right).value(); - - return a->getCreationTime() > b->getCreationTime() || b->isMe(); +bool ParticipantProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const { + const ParticipantModel *a = sourceModel()->data(left).value(); + const ParticipantModel *b = sourceModel()->data(right).value(); + bool bIsRecent = a->getCreationTime() < b->getCreationTime(); + bool aIsMe = a->isMe(); + bool bIsMe = b->isMe(); + return bIsMe || (bIsRecent && !aIsMe); }