From 5a43acd42a1bc570611634b1e9c14abc35bb94d5 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 30 Jun 2020 19:51:28 -0600 Subject: [PATCH] Fix reaction event crashes in message previews Fixes https://github.com/vector-im/riot-web/issues/14224 --- src/stores/room-list/previews/ReactionEventPreview.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/stores/room-list/previews/ReactionEventPreview.ts b/src/stores/room-list/previews/ReactionEventPreview.ts index d58f592feb..07fac107ca 100644 --- a/src/stores/room-list/previews/ReactionEventPreview.ts +++ b/src/stores/room-list/previews/ReactionEventPreview.ts @@ -22,8 +22,11 @@ import { _t } from "../../../languageHandler"; export class ReactionEventPreview implements IPreview { public getTextFor(event: MatrixEvent, tagId?: TagID): string { - const reaction = event.getRelation().key; - if (!reaction) return; + const relation = event.getRelation(); + if (!relation) return null; // invalid reaction (probably redacted) + + const reaction = relation.key; + if (!reaction) return null; // invalid reaction (unknown format) if (isSelf(event) || !shouldPrefixMessagesIn(event.getRoomId(), tagId)) { return reaction;