From e18c8c77aef6a5ac36b2a9c22daa8f3fb8efb7cb Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Thu, 22 Oct 2020 20:56:27 +1300 Subject: [PATCH] Fallback to room name "empty room" --- src/js/room-picker.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/js/room-picker.js b/src/js/room-picker.js index d2e79fa..5a5340c 100644 --- a/src/js/room-picker.js +++ b/src/js/room-picker.js @@ -106,8 +106,12 @@ class Room extends ElemJS { } // if the room has no alias, use the names of its members ("heroes") const users = this.data.summary["m.heroes"] - const usernames = users.map(u => (u.match(/^@([^:]+):/) || [])[1] || u) - return usernames.join(", ") + if (users && users.length) { + const usernames = users.map(u => (u.match(/^@([^:]+):/) || [])[1] || u) + return usernames.join(", ") + } + // the room is empty + return "Empty room" } getIcon() {