From c6f0a41559e88fc6085b63062bcb5b1f5cf2b384 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Tue, 2 Feb 2021 20:27:42 +0100 Subject: [PATCH] Fix default value if no own message was found --- src/chatmodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index c723d88..68695a3 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -755,12 +755,12 @@ int ChatModel::calculateLastKnownMessageId() LOG("contains last read ID?" << messageIndexMap.contains(lastKnownMessageId)); LOG("contains last own ID?" << messageIndexMap.contains(lastOwnMessageId)); int listInboxPosition = messageIndexMap.value(lastKnownMessageId, messages.size() - 1); - int listOwnPosition = messageIndexMap.value(lastOwnMessageId, messages.size() - 1); + int listOwnPosition = messageIndexMap.value(lastOwnMessageId, 0); if (listInboxPosition > this->messages.size() - 1 ) { listInboxPosition = this->messages.size() - 1; } if (listOwnPosition > this->messages.size() - 1 ) { - listOwnPosition = this->messages.size() - 1; + listOwnPosition = 0; } LOG("Last known message is at position" << listInboxPosition); LOG("Last own message is at position" << listOwnPosition);