Fix crash in E2E rooms
authorAjay Bura <ajbura@gmail.com>
Thu, 9 Dec 2021 09:57:59 +0000 (15:27 +0530)
committerAjay Bura <ajbura@gmail.com>
Thu, 9 Dec 2021 09:57:59 +0000 (15:27 +0530)
Signed-off-by: Ajay Bura <ajbura@gmail.com>
src/app/molecules/message/Message.jsx

index fa5d608a89c150af0a79d0bee59052e3f8fad42e..74c343f6d25dce8619fcd70c957ec031c7a06e88 100644 (file)
@@ -574,7 +574,14 @@ function Message({
   let { body } = content;
   const username = getUsernameOfRoomMember(mEvent.sender);
 
-  if (typeof body === 'undefined') return null;
+  const edit = useCallback(() => {
+    setIsEditing(true);
+  }, []);
+  const reply = useCallback(() => {
+    replyTo(senderId, eventId, body);
+  }, [body]);
+
+  if (body === undefined) return null;
   if (msgType === 'm.emote') className.push('message--type-emote');
 
   let isCustomHTML = content.format === 'org.matrix.custom.html';
@@ -594,13 +601,6 @@ function Message({
     body = parseReply(body)?.body ?? body;
   }
 
-  const edit = useCallback(() => {
-    setIsEditing(true);
-  }, []);
-  const reply = useCallback(() => {
-    replyTo(senderId, eventId, body);
-  }, [body]);
-
   return (
     <div className={className.join(' ')}>
       {