Subversion Repository Public Repository

Nextrek

Diff Revisions 1129 vs 1130 for /socketIO/chat.js

Diff revisions: vs.
  @@ -140,13 +140,15 @@
140 140 const promises = [];
141 141 if (host.room === guest.room) {
142 142 // host leaving his own room means throw out guest(s)
143 - this.rooms[host.role][host.room].forEach(user => {
144 - if (this.socketsMap[user.room]) {
145 - promises.push(new Promise(resolve => {
146 - resolve(this.socketsMap[user.room]);
147 - }));
148 - }
149 - });
143 + if (this.rooms[host.role][host.room]) {
144 + this.rooms[host.role][host.room].forEach(user => {
145 + if (this.socketsMap[user.room]) {
146 + promises.push(new Promise(resolve => {
147 + resolve(this.socketsMap[user.room]);
148 + }));
149 + }
150 + });
151 + }
150 152 delete this.rooms[host.role][host.room];
151 153 } else {
152 154 // operators are only allowed to leave other operators' rooms