From 006d5d7591279cfe19fd000a4599ca70c91c5570 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Thu, 16 May 2019 13:57:02 +0100 Subject: [PATCH] Fix crash for null reactions set --- src/components/views/messages/ReactionDimension.js | 6 +++++- src/components/views/messages/ReactionsRow.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/views/messages/ReactionDimension.js b/src/components/views/messages/ReactionDimension.js index 0c91d0ac99..843254ade3 100644 --- a/src/components/views/messages/ReactionDimension.js +++ b/src/components/views/messages/ReactionDimension.js @@ -113,7 +113,11 @@ export default class ReactionDimension extends React.PureComponent { return null; } const userId = MatrixClientPeg.get().getUserId(); - return [...reactions.getAnnotationsBySender()[userId].values()]; + const myReactions = reactions.getAnnotationsBySender()[userId]; + if (!myReactions) { + return null; + } + return [...myReactions.values()]; } onOptionClick = (ev) => { diff --git a/src/components/views/messages/ReactionsRow.js b/src/components/views/messages/ReactionsRow.js index cd3ccb6809..d55ecd6578 100644 --- a/src/components/views/messages/ReactionsRow.js +++ b/src/components/views/messages/ReactionsRow.js @@ -86,7 +86,11 @@ export default class ReactionsRow extends React.PureComponent { return null; } const userId = MatrixClientPeg.get().getUserId(); - return [...reactions.getAnnotationsBySender()[userId].values()]; + const myReactions = reactions.getAnnotationsBySender()[userId]; + if (!myReactions) { + return null; + } + return [...myReactions.values()]; } render() {