From 69db4108088a9665d96151e94bec5c7b4870b93d Mon Sep 17 00:00:00 2001
From: Dragory <2606411+Dragory@users.noreply.github.com>
Date: Thu, 4 Jun 2020 02:32:27 +0300
Subject: [PATCH] mutes: fix error when member to unmute cannot be found

---
 backend/src/plugins/ModActions.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/backend/src/plugins/ModActions.ts b/backend/src/plugins/ModActions.ts
index 6079c383..e10d8a71 100644
--- a/backend/src/plugins/ModActions.ts
+++ b/backend/src/plugins/ModActions.ts
@@ -1044,7 +1044,7 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
     if (!user) return this.sendErrorMessage(msg.channel, `User not found`);
     const memberToUnmute = await this.getMember(user.id);
     const mutesPlugin = this.getPlugin<MutesPlugin>("mutes");
-    const hasMuteRole = mutesPlugin.hasMutedRole(memberToUnmute);
+    const hasMuteRole = memberToUnmute && mutesPlugin.hasMutedRole(memberToUnmute);
 
     // Check if they're muted in the first place
     if (!(await this.mutes.isMuted(args.user)) && !hasMuteRole) {