From 9c568caf1f7f8062083c533bd8eae3894de35c84 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 26 May 2021 15:47:02 +1000 Subject: [PATCH] fix replying to audio message crash Fixes #1657 --- .../session/conversation/SessionQuotedMessageComposition.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ts/components/session/conversation/SessionQuotedMessageComposition.tsx b/ts/components/session/conversation/SessionQuotedMessageComposition.tsx index 140c37d2d..96a1c9218 100644 --- a/ts/components/session/conversation/SessionQuotedMessageComposition.tsx +++ b/ts/components/session/conversation/SessionQuotedMessageComposition.tsx @@ -5,6 +5,7 @@ import { ReplyingToMessageProps } from './SessionCompositionBox'; import styled, { DefaultTheme, ThemeContext } from 'styled-components'; import { getAlt, isAudio, isImageAttachment } from '../../../types/Attachment'; import { Image } from '../../conversation/Image'; +import { AUDIO_MP3 } from '../../../types/MIME'; // tslint:disable: react-unused-props-and-state interface Props { @@ -50,7 +51,9 @@ export const SessionQuotedMessageComposition = (props: Props) => { let hasImageAttachment = false; let firstImageAttachment; - if (attachments && attachments.length > 0) { + // we have to handle the case we are trying to reply to an audio message + + if (attachments?.length && attachments[0].contentType !== AUDIO_MP3 && attachments[0].thumbnail) { firstImageAttachment = attachments[0]; hasImageAttachment = true; }