From 47125fd7fd055e3eb37b31815073b40609e6709d Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Tue, 18 Aug 2020 21:43:30 +0300 Subject: [PATCH] Fix rare crash in typingProxy --- src/modules/typingProxy.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/typingProxy.js b/src/modules/typingProxy.js index cdcc97a..e84d085 100644 --- a/src/modules/typingProxy.js +++ b/src/modules/typingProxy.js @@ -6,6 +6,11 @@ module.exports = ({ bot }) => { // Typing proxy: forwarding typing events between the DM and the modmail thread if(config.typingProxy || config.typingProxyReverse) { bot.on("typingStart", async (channel, user) => { + if (! user) { + // If the user doesn't exist in the bot's cache, it will be undefined here + return; + } + // config.typingProxy: forward user typing in a DM to the modmail thread if (config.typingProxy && (channel instanceof Eris.PrivateChannel)) { const thread = await threads.findOpenThreadByUserId(user.id);