From ee671f81e2cd96bdc4f7681060c8044e8742df90 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Wed, 14 Sep 2011 17:31:26 +0100 Subject: [PATCH] modules need to be created first --- run.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/run.js b/run.js index fe245a4..71a13da 100644 --- a/run.js +++ b/run.js @@ -30,11 +30,13 @@ DBot.prototype.save = function() { }; DBot.prototype.reloadModules = function() { - this.modules.each(function(module) { - if(module.onDestroy) { - module.onDestroy(); - } - }); + if(this.modules) { + this.modules.each(function(module) { + if(module.onDestroy) { + module.onDestroy(); + } + }); + } this.rawModules = []; this.modules = [];