Fix crash in profile viewer
authorAjay Bura <ajbura@gmail.com>
Thu, 13 Jan 2022 05:03:04 +0000 (10:33 +0530)
committerAjay Bura <ajbura@gmail.com>
Thu, 13 Jan 2022 05:03:04 +0000 (10:33 +0530)
Signed-off-by: Ajay Bura <ajbura@gmail.com>
src/app/organisms/profile-viewer/ProfileViewer.jsx

index 320cf2cfc065a9169eca37685e1a2ffd3c2b3534..23890125e5a133b18daf92c36269b3257edf524c 100644 (file)
@@ -358,7 +358,7 @@ function ProfileViewer() {
   const renderProfile = () => {
     const roomMember = room.getMember(userId);
     const username = roomMember ? getUsernameOfRoomMember(roomMember) : getUsername(userId);
-    const avatarMxc = roomMember?.getMxcAvatarUrl?.() || mx.getUser(userId).avatarUrl;
+    const avatarMxc = roomMember?.getMxcAvatarUrl?.() || mx.getUser(userId)?.avatarUrl;
     const avatarUrl = (avatarMxc && avatarMxc !== 'null') ? mx.mxcUrlToHttp(avatarMxc, 80, 80, 'crop') : null;
 
     const powerLevel = roomMember.powerLevel || 0;