From 11aa6f8c3717157d16b43e4840e1df7f07ad9654 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 19 Oct 2015 14:33:45 +0100 Subject: [PATCH] Null check userId on member. Fixes #5. --- src/Avatar.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Avatar.js b/src/Avatar.js index 2f83ebd9..8de29f1d 100644 --- a/src/Avatar.js +++ b/src/Avatar.js @@ -27,7 +27,10 @@ module.exports = { resizeMethod ); if (!url) { - url = this.defaultAvatarUrlForString(member.userId); + // member can be null here currently since on invites, the JS SDK + // does not have enough info to build a RoomMember object for + // the inviter. + url = this.defaultAvatarUrlForString(member ? member.userId : ''); } return url; },