don't assume a member has events associated

This commit is contained in:
Bruno Windels 2018-07-13 15:46:46 +02:00
parent 8529bc55e3
commit af77f0206a

View file

@ -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();
}