From 042e4544b7b4d8ad6f03166ebae4a5c0207446cf Mon Sep 17 00:00:00 2001 From: calzoneman Date: Thu, 20 Jun 2013 14:56:52 -0400 Subject: [PATCH] Fix dump bug --- channel.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/channel.js b/channel.js index c727834c..c17767e4 100644 --- a/channel.js +++ b/channel.js @@ -136,6 +136,11 @@ Channel.prototype.hasPermission = function(user, key) { Channel.prototype.loadDump = function() { fs.readFile("chandump/" + this.name, function(err, data) { if(err) { + if(err.code === "ENOENT") { + Logger.errlog.log("WARN: missing dump for " + this.name); + this.initialized = true; + this.saveDump(); + } Logger.errlog.log("Failed to open channel dump " + this.name); Logger.errlog.log(err); return; @@ -281,6 +286,8 @@ Channel.prototype.tryRegister = function(user) { else { if(Database.registerChannel(this.name)) { this.registered = true; + this.initialized = true; + this.saveDump(); this.saveRank(user); user.socket.emit("registerChannel", { success: true,