From 777ea2dd2c053a6d40cdfe34fe64c6b1a13ceece Mon Sep 17 00:00:00 2001 From: Miikka Date: Thu, 3 May 2018 14:22:38 +0300 Subject: [PATCH] Fix crash when user edits a DM after the thread is closed --- src/main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.js b/src/main.js index 0b23fd9..58f3c30 100644 --- a/src/main.js +++ b/src/main.js @@ -110,8 +110,9 @@ bot.on('messageUpdate', async (msg, oldMessage) => { // 1) Edit in DMs if (msg.channel instanceof Eris.PrivateChannel) { const thread = await threads.findOpenThreadByUserId(msg.author.id); + if (! thread) return; + const editMessage = utils.disableLinkPreviews(`**The user edited their message:**\n\`B:\` ${oldContent}\n\`A:\` ${newContent}`); - thread.postSystemMessage(editMessage); }