From 130d3e33365c1530cbfccbb31f23f8d28c003e25 Mon Sep 17 00:00:00 2001 From: Michal Iskierko Date: Thu, 7 Mar 2024 12:56:15 +0100 Subject: [PATCH] fix(@desktop/chat): Fix referencing message nil pointer Fix #13812 --- .../main/chat_section/chat_content/messages/module.nim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/modules/main/chat_section/chat_content/messages/module.nim b/src/app/modules/main/chat_section/chat_content/messages/module.nim index ca57cc2ccd..c6297caa11 100644 --- a/src/app/modules/main/chat_section/chat_content/messages/module.nim +++ b/src/app/modules/main/chat_section/chat_content/messages/module.nim @@ -439,6 +439,8 @@ method toggleReaction*(self: Module, messageId: string, emojiId: int) = var emojiIdAsEnum: EmojiId if(message_reaction_item.toEmojiIdAsEnum(emojiId, emojiIdAsEnum)): let item = self.view.model().getItemWithMessageId(messageId) + if(item.isNil): + return let myPublicKey = singletonInstance.userProfile.getPubKey() if(item.shouldAddReaction(emojiIdAsEnum, myPublicKey)): self.controller.addReaction(messageId, emojiId) @@ -569,6 +571,8 @@ method onMessageDeleted*(self: Module, messageId, deletedBy: string) = if deletedBy == "": # deletedBy is empty if it was deleted by the sender let messageItem = self.view.model().getItemWithMessageId(messageId) + if(messageItem.isNil): + return if messageItem.id == "": return deletedByValue = messageItem.senderId