1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-04 05:02:41 +03:00

check heroes is not falsy first, this would fail without LL

This commit is contained in:
Bruno Windels
2018-09-04 13:00:34 +02:00
parent 632e4aa120
commit 3e32bc0d5d

View File

@@ -303,10 +303,11 @@ Room.prototype.guessDMUserId = function() {
if (fallbackMember) {
return fallbackMember.userId;
}
// now we're getting into sketchy territory,
// but we're assuming this room is marked as a DM
// so we're going to make a wild-ish guess with whom
if (this._summaryHeroes.length) {
// remember, we're assuming this room is a DM,
// so returning the first member we find should be fine
const hasHeroes = Array.isArray(this._summaryHeroes) &&
this._summaryHeroes.length;
if (hasHeroes) {
return this._summaryHeroes[0];
}
const members = this.currentState.getMembers();