Fixed crash in ChatModel

QList::first() panics if the list is empty.
This commit is contained in:
Slava Monich 2020-11-01 04:57:37 +02:00
parent 72315312d6
commit 4049d4aa7c

View file

@ -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());