From 1a6146b3487ca31a92708ac4aac80d5266077ac0 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Mon, 27 Feb 2012 15:11:43 +0000 Subject: [PATCH] delete category when rmlast makes empty quote category --- modules/quotes.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/quotes.js b/modules/quotes.js index 0b2bd9c..2651097 100644 --- a/modules/quotes.js +++ b/modules/quotes.js @@ -52,6 +52,9 @@ var quotes = function(dbot) { if(quotes.hasOwnProperty(q[1])) { if(!dbot.db.locks.include(q[1]) || data.user == dbot.admin) { var quote = quotes[key].pop(); + if(quotes[key] === undefined) { + delete quotes[key]; + } rmAllowed = false; dbot.say(data.channel, '\'' + quote + '\' removed from ' + q[1]); } else {