1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-09-10 12:03:18 +02:00

conversationmodel: avoid loading loop if no messages

Also avoid any potential crash if for whatever reason no interactions
is detected

Change-Id: I7738e3f39cd626ef4fc64612f71d55e73d567fa2
This commit is contained in:
Sébastien Blin 2022-06-28 15:13:26 -04:00
parent 47af6ffc03
commit 21431c80c9

View file

@ -2239,7 +2239,7 @@ ConversationModelPimpl::slotConversationLoaded(uint32_t requestId,
return;
}
auto allLoaded = false;
auto allLoaded = messages.size() == 0;
try {
auto& conversation = getConversationForUid(conversationId).get();
@ -2304,11 +2304,13 @@ ConversationModelPimpl::slotConversationLoaded(uint32_t requestId,
}
if (conversation.lastMessageUid.isEmpty() && !conversation.allMessagesLoaded
&& messages.size() != 0) {
QString newLast = conversation.interactions->rbegin()->first;
if (newLast == oldLast && !newLast.isEmpty()) { // [[unlikely]] in c++20
qCritical() << "Loading loop detected for " << conversationId << "(" << newLast
<< ")";
return;
if (conversation.interactions->size() > 0) {
QString newLast = conversation.interactions->rbegin()->first;
if (newLast == oldLast && !newLast.isEmpty()) { // [[unlikely]] in c++20
qCritical() << "Loading loop detected for " << conversationId << "(" << newLast
<< ")";
return;
}
}
// In this case, we only have loaded merge commits. Load more messages