From 4049d4aa7cd3406ff137af6931b05faa2ddfe3cc Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sun, 1 Nov 2020 04:57:37 +0200 Subject: [PATCH] Fixed crash in ChatModel QList::first() panics if the list is empty. --- src/chatmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index 7525c8e..6e42e21 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -83,7 +83,7 @@ void ChatModel::initialize(const QVariantMap &chatInformation) void ChatModel::triggerLoadMoreHistory() { - if (!this->inIncrementalUpdate) { + if (!this->inIncrementalUpdate && !messages.isEmpty()) { qDebug() << "[ChatModel] Trigger loading older history..."; this->inIncrementalUpdate = true; this->tdLibWrapper->getChatHistory(this->chatId, this->messages.first().toMap().value("id").toLongLong());