diff --git a/index.js b/index.js index aeb5b6e..f21dcbd 100644 --- a/index.js +++ b/index.js @@ -74,8 +74,8 @@ Adapter.prototype.addAll = function(id, rooms, fn){ */ Adapter.prototype.del = function(id, room, fn){ - this.sids[id] = this.sids[id] || {}; - delete this.sids[id][room]; + if (this.sids[id]) delete this.sids[id][room]; + if (this.rooms.hasOwnProperty(room)) { this.rooms[room].del(id); if (this.rooms[room].length === 0) delete this.rooms[room];