Skip to content
This repository has been archived by the owner on Jul 3, 2021. It is now read-only.

Commit

Permalink
Fix: Return empty array if currentDJ or waitingDJs is null for getWai…
Browse files Browse the repository at this point in the history
…tList & getDJs

Fixes #145
  • Loading branch information
thedark1337 committed Oct 20, 2017
1 parent c7a28ef commit 8e63576
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,10 @@ class Room {
* @returns {User[]} An Array of all DJs in the room and the current DJ.
*/
getDJs() {
if (this.booth.currentDJ == null || this.booth.waitingDJs == null) {
return [];
}

return this.usersToArray([this.booth.currentDJ].concat(this.booth.waitingDJs));
}

Expand All @@ -690,6 +694,10 @@ class Room {
* @returns {User[]} An Array of all DJs in the room that are in waitlist
*/
getWaitList() {
if (this.booth.waitingDJs == null) {
return [];
}

return this.usersToArray(this.booth.waitingDJs);
}

Expand Down

0 comments on commit 8e63576

Please sign in to comment.