1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-04-21 21:52:03 +02:00

messagesadapter: protect loadMoreMessages

Change-Id: I4a8d7105ed6ea5600fc4596f62b56991631358b8
This commit is contained in:
Sébastien Blin 2022-12-29 13:21:14 -05:00
parent be036ba6b7
commit 9d70fe10eb
No known key found for this signature in database
GPG key ID: C894BB01EEB2A9A9

View file

@ -91,16 +91,21 @@ MessagesAdapter::loadMoreMessages()
{
auto accountId = lrcInstance_->get_currentAccountId();
auto convId = lrcInstance_->get_selectedConvUid();
try {
const auto& convInfo = lrcInstance_->getConversationFromConvUid(convId, accountId);
if (convInfo.isSwarm()) {
auto* convModel = lrcInstance_->getCurrentConversationModel();
convModel->loadConversationMessages(convId, loadChunkSize_);
}
} catch (const std::exception& e) {
qWarning() << e.what();
}
}
void
MessagesAdapter::loadConversationUntil(const QString& to)
{
try {
if (auto* model = messageListModel_.value<MessageListModel*>()) {
auto idx = model->indexOfMessage(to);
if (idx == -1) {
@ -113,6 +118,9 @@ MessagesAdapter::loadConversationUntil(const QString& to)
}
}
}
} catch (const std::exception& e) {
qWarning() << e.what();
}
}
void