From ea9fa0a95a6ad23473298cf9ef19b58367369937 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Tue, 2 Sep 2014 16:46:53 -0500 Subject: [PATCH] Fix /smute with 0 args throwing error --- lib/channel/chat.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/channel/chat.js b/lib/channel/chat.js index d5805aaf..8bce8874 100644 --- a/lib/channel/chat.js +++ b/lib/channel/chat.js @@ -487,7 +487,15 @@ ChatModule.prototype.handleCmdSMute = function (user, msg, meta) { var args = msg.split(" "); args.shift(); /* shift off /smute */ - var name = args.shift().toLowerCase(); + var name = args.shift(); + if (typeof name !== "string") { + user.socket.emit("errorMsg", { + msg: "/smute requires a target name" + }); + return; + } + name = name.toLowerCase(); + var target; for (var i = 0; i < this.channel.users.length; i++) {