From e8292ba803596a2605d0ff8a94f51eb8707c115a Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 17 Mar 2014 01:51:26 +0100 Subject: newsbot.js: only delete real slaves --- news/newsbot.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/news/newsbot.js b/news/newsbot.js index 499f595a..55564f0f 100644 --- a/news/newsbot.js +++ b/news/newsbot.js @@ -228,10 +228,11 @@ methods.add = function (params, callback) { } } methods.del = function (params, callback) { - var slave = slaves[params[0]] - if (slave) { + var nick = params[0] + if (slaves.hasOwnProperty(nick)) { + var slave = slaves[nick] slave.client.disconnect() - delete slaves[params[0]] + delete slaves[nick] return callback(null) } else { return callback(new Error('botname not found')) -- cgit v1.2.3