From 917db7a8db960d914d207a967bdd3603dbf040e0 Mon Sep 17 00:00:00 2001 From: Edgard Messias Date: Mon, 16 Nov 2020 14:42:11 -0300 Subject: [PATCH] fix: Fixed error on replying a invalid message (close #320) --- src/lib/wapi/functions/reply.js | 2 +- src/lib/wapi/functions/sendMessageOptions.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/wapi/functions/reply.js b/src/lib/wapi/functions/reply.js index cc4603fa1..f2bb5597d 100644 --- a/src/lib/wapi/functions/reply.js +++ b/src/lib/wapi/functions/reply.js @@ -59,7 +59,7 @@ export async function reply(chatId, content, quotedMessageId) { let quotedMsgOptions = {}; if (quotedMessageId) { let quotedMessage = window.Store.Msg.get(quotedMessageId); - if (quotedMessage.canReply()) { + if (quotedMessage && quotedMessage.canReply()) { quotedMsgOptions = quotedMessage.msgContextInfo(chat); } } diff --git a/src/lib/wapi/functions/sendMessageOptions.js b/src/lib/wapi/functions/sendMessageOptions.js index 4843d4ae4..9cc72184a 100644 --- a/src/lib/wapi/functions/sendMessageOptions.js +++ b/src/lib/wapi/functions/sendMessageOptions.js @@ -74,7 +74,7 @@ export async function sendMessageOptions(chatId, content, options = {}) { let quotedMsgOptions = {}; if (options.quotedMessageId) { let quotedMessage = window.Store.Msg.get(options.quotedMessageId); - if (quotedMessage.canReply()) { + if (quotedMessage && quotedMessage.canReply()) { quotedMsgOptions = quotedMessage.msgContextInfo(chat); } delete options.quotedMessageId;