From c5de1b3dbedf378487b373c2cf949487fa24c6ca Mon Sep 17 00:00:00 2001 From: realies Date: Tue, 31 Oct 2017 19:46:58 +0000 Subject: [PATCH] handle empty client queries --- src/plugins/inputs/query.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/inputs/query.js b/src/plugins/inputs/query.js index 2cf23e8a..3538e1f1 100644 --- a/src/plugins/inputs/query.js +++ b/src/plugins/inputs/query.js @@ -7,11 +7,15 @@ var Msg = require("../../models/msg"); exports.commands = ["query"]; exports.input = function(network, chan, cmd, args) { - if (args.length === 0) { + var target = args[0]; + if (args.length === 0 || target.length === 0) { + chan.pushMessage(this, new Msg({ + type: Msg.Type.ERROR, + text: "You cannot open a query window without an argument.", + })); return; } - var target = args[0]; var query = _.find(network.channels, {name: target}); if (typeof query !== "undefined") { return;