From 5a183c590e1cb1624cf7c568cd9140c1d53ba5d2 Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Wed, 26 Jan 2022 17:13:07 +0000 Subject: [PATCH] Use null guarded thread getter in EventTile --- src/components/views/rooms/EventTile.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/views/rooms/EventTile.tsx b/src/components/views/rooms/EventTile.tsx index 615a0d9eae..90f8aad11e 100644 --- a/src/components/views/rooms/EventTile.tsx +++ b/src/components/views/rooms/EventTile.tsx @@ -383,8 +383,8 @@ export default class EventTile extends React.Component { constructor(props: IProps, context: React.ContextType) { super(props, context); - const room = MatrixClientPeg.get().getRoom(this.props.mxEvent.getRoomId()); - const thread = room.threads?.get(this.props.mxEvent.getId()); + this.context = context; + const thread = this.thread; this.state = { // Whether the action bar is focused. @@ -630,7 +630,7 @@ export default class EventTile extends React.Component { * We currently have no reliable way to discover than an event is a thread * when we are at the sync stage */ - const room = this.context.getRoom(this.props.mxEvent.getRoomId()); + const room = MatrixClientPeg.get().getRoom(this.props.mxEvent.getRoomId()); const thread = room?.threads.get(this.props.mxEvent.getId()); if (!thread || thread.length === 0) {