From af77f0206af4f71895f9aea0f6ba3054f229adec Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 13 Jul 2018 15:46:46 +0200 Subject: [PATCH] don't assume a member has events associated --- src/Rooms.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Rooms.js b/src/Rooms.js index 607bd60b98..aa025d7dc5 100644 --- a/src/Rooms.js +++ b/src/Rooms.js @@ -166,7 +166,7 @@ export function guessDMRoomTarget(room, me) { for (const user of room.getJoinedMembers()) { if (user.userId == me.userId) continue; - if (oldestTs === undefined || user.events.member.getTs() < oldestTs) { + if (oldestTs === undefined || (user.events.member && user.events.member.getTs() < oldestTs)) { oldestUser = user; oldestTs = user.events.member.getTs(); } @@ -177,7 +177,7 @@ export function guessDMRoomTarget(room, me) { for (const user of room.currentState.getMembers()) { if (user.userId == me.userId) continue; - if (oldestTs === undefined || user.events.member.getTs() < oldestTs) { + if (oldestTs === undefined || (user.events.member && user.events.member.getTs() < oldestTs)) { oldestUser = user; oldestTs = user.events.member.getTs(); }