Make the room exists when autopruning.

This commit is contained in:
Tony Kovanen
2014-09-19 18:07:08 -06:00
parent 2e061ee733
commit 3e6489bf71

View File

@@ -64,7 +64,7 @@ Adapter.prototype.del = function(id, room, fn){
this.rooms[room] = this.rooms[room] || {};
delete this.sids[id][room];
delete this.rooms[room][id];
if (!keys(this.rooms[room]).length) {
if (this.rooms.hasOwnProperty(room) && !keys(this.rooms[room]).length) {
delete this.rooms[room];
}
@@ -86,7 +86,7 @@ Adapter.prototype.delAll = function(id, fn){
delete this.rooms[room][id];
}
if (!keys(this.rooms[room]).length) {
if (this.rooms.hasOwnProperty(room) && !keys(this.rooms[room]).length) {
delete this.rooms[room];
}
}