Handle messages with invalid body (#833)
authorginnyTheCat <ginnythecat@lelux.net>
Sun, 11 Sep 2022 13:21:05 +0000 (15:21 +0200)
committerGitHub <noreply@github.com>
Sun, 11 Sep 2022 13:21:05 +0000 (18:51 +0530)
src/app/molecules/message/Message.jsx

index 7d3ee63b9166ea16bc4c91aa80955227594b4873..ab05e0e885984685b8ce48888a005b93f3bc2d7a 100644 (file)
@@ -737,7 +737,6 @@ function Message({
     replyTo(senderId, mEvent.getId(), body);
   }, [body]);
 
-  if (body === undefined) return null;
   if (msgType === 'm.emote') className.push('message--type-emote');
 
   let isCustomHTML = content.format === 'org.matrix.custom.html';
@@ -752,13 +751,14 @@ function Message({
     const editedList = editedTimeline.get(eventId);
     const editedMEvent = editedList[editedList.length - 1];
     [body, isCustomHTML, customHTML] = getEditedBody(editedMEvent);
-    if (typeof body !== 'string') return null;
   }
 
   if (isReply) {
     body = parseReply(body)?.body ?? body;
   }
 
+  if (typeof body !== 'string') body = '';
+
   return (
     <div className={className.join(' ')}>
       {