From 760446c0879fd5e7ad82b905df1815874411fea4 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 8 Feb 2022 14:26:26 +0000 Subject: [PATCH] Null-guard ELS from null summaryMembers (#7744) --- src/components/views/elements/EventListSummary.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/views/elements/EventListSummary.tsx b/src/components/views/elements/EventListSummary.tsx index e6041b0fff..10e18623fb 100644 --- a/src/components/views/elements/EventListSummary.tsx +++ b/src/components/views/elements/EventListSummary.tsx @@ -18,6 +18,7 @@ import React, { ReactNode, useEffect } from "react"; import { uniqBy } from "lodash"; import { MatrixEvent } from "matrix-js-sdk/src/models/event"; import { RoomMember } from "matrix-js-sdk/src/models/room-member"; +import { logger } from "matrix-js-sdk/src/logger"; import MemberAvatar from '../avatars/MemberAvatar'; import { _t } from '../../../languageHandler'; @@ -81,7 +82,14 @@ const EventListSummary: React.FC = ({ { children } ; } else { - const uniqueMembers = uniqBy(summaryMembers, member => member.getMxcAvatarUrl()); + const uniqueMembers = uniqBy(summaryMembers.filter(member => { + if (!member?.getMxcAvatarUrl) { + logger.error("EventListSummary given null summaryMember, termites may be afoot eating event senders", + summaryMembers); + return false; + } + return true; + }), member => member.getMxcAvatarUrl()); const avatars = uniqueMembers.map((m) => ); body = (