From b6a980490862ecf114b60d8da9335737c85d7b52 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 14 Jun 2022 15:39:57 -0600 Subject: [PATCH] Add a bit of safety around timestamp handling for threads --- src/components/views/rooms/EventTile.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/EventTile.tsx b/src/components/views/rooms/EventTile.tsx index ee853a70ea8..bd2d7fb961f 100644 --- a/src/components/views/rooms/EventTile.tsx +++ b/src/components/views/rooms/EventTile.tsx @@ -1121,9 +1121,13 @@ export class UnwrappedEventTile extends React.Component { || Boolean(this.state.contextMenu)); // Thread panel shows the timestamp of the last reply in that thread - const ts = this.context.timelineRenderingType !== TimelineRenderingType.ThreadsList + let ts = this.context.timelineRenderingType !== TimelineRenderingType.ThreadsList ? this.props.mxEvent.getTs() - : this.state.thread?.replyToEvent.getTs(); + : this.state.thread?.replyToEvent?.getTs(); + if (typeof ts !== "number") { + // Fall back to something we can use + ts = this.props.mxEvent.getTs(); + } const messageTimestamp =