fix(chat/messages): prevent manipulation of uninitialized cursor

fixes: #9361
This commit is contained in:
Patryk Osmaczko 2023-02-14 11:01:15 +01:00 committed by osmaczko
parent 7c1b4e37f3
commit 63bbf266a0
1 changed files with 6 additions and 5 deletions

View File

@ -247,11 +247,12 @@ QtObject:
continue
# Ignore messages older than current chat cursor
let currentChatCursor = self.initOrGetMessageCursor(chatId)
let msgCursorValue = initCursorValue(msg.id, msg.clock)
if(not currentChatCursor.isLessThan(msgCursorValue)):
currentChatCursor.makeObsolete()
continue
if(self.isChatCursorInitialized(chatId)):
let currentChatCursor = self.initOrGetMessageCursor(chatId)
let msgCursorValue = initCursorValue(msg.id, msg.clock)
if(not currentChatCursor.isLessThan(msgCursorValue)):
currentChatCursor.makeObsolete()
continue
if(msg.editedAt > 0):
let data = MessageEditedArgs(chatId: msg.localChatId, message: msg)