From f03187190eca9d2a30fec1d71cc3bb45cc572aa2 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 9 Jul 2019 15:00:26 +0200 Subject: [PATCH] Don't try to call bodyToHtml with an empty content with the stripReply flag, this crashes. --- .../views/messages/EditHistoryMessage.js | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/components/views/messages/EditHistoryMessage.js b/src/components/views/messages/EditHistoryMessage.js index 44d98abc0a..fe8d465698 100644 --- a/src/components/views/messages/EditHistoryMessage.js +++ b/src/components/views/messages/EditHistoryMessage.js @@ -119,22 +119,25 @@ export default class EditHistoryMessage extends React.PureComponent { const {mxEvent} = this.props; const originalContent = mxEvent.getOriginalContent(); const content = originalContent["m.new_content"] || originalContent; - const contentElements = HtmlUtils.bodyToHtml(content, null, {stripReplyFallback: true}); let contentContainer; if (mxEvent.isRedacted()) { const UnknownBody = sdk.getComponent('messages.UnknownBody'); contentContainer = ; - } else if (mxEvent.getContent().msgtype === "m.emote") { - const name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender(); - contentContainer = ( -
*  - { name } -  {contentElements} -
- ); } else { - contentContainer =
{contentElements}
; + const contentElements = HtmlUtils.bodyToHtml(content, null, {stripReplyFallback: true}); + if (mxEvent.getContent().msgtype === "m.emote") { + const name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender(); + contentContainer = ( +
*  + { name } +  {contentElements} +
+ ); + } else { + contentContainer =
{contentElements}
; + } } + const timestamp = formatTime(new Date(mxEvent.getTs()), this.props.isTwelveHour); const isSending = (['sending', 'queued', 'encrypting'].indexOf(this.state.sendStatus) !== -1); const classes = classNames({