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) { if (fallbackMember) {
return fallbackMember.userId; return fallbackMember.userId;
} }
// now we're getting into sketchy territory, // remember, we're assuming this room is a DM,
// but we're assuming this room is marked as a DM // so returning the first member we find should be fine
// so we're going to make a wild-ish guess with whom const hasHeroes = Array.isArray(this._summaryHeroes) &&
if (this._summaryHeroes.length) { this._summaryHeroes.length;
if (hasHeroes) {
return this._summaryHeroes[0]; return this._summaryHeroes[0];
} }
const members = this.currentState.getMembers(); const members = this.currentState.getMembers();