diff --git a/src/components/views/messages/RedactedBody.tsx b/src/components/views/messages/RedactedBody.tsx index e347e879a3..5dada64b52 100644 --- a/src/components/views/messages/RedactedBody.tsx +++ b/src/components/views/messages/RedactedBody.tsx @@ -28,8 +28,9 @@ const RedactedBody = React.forwardRef(({mxEvent}, ref) => { const cli: MatrixClient = useContext(MatrixClientContext); let text = _t("Message deleted"); - const redactedBecauseUserId = mxEvent.getUnsigned().redacted_because.sender; - if (redactedBecauseUserId && redactedBecauseUserId !== cli.getUserId()) { + const unsigned = mxEvent.getUnsigned(); + const redactedBecauseUserId = unsigned && unsigned.redacted_because && unsigned.redacted_because.sender; + if (redactedBecauseUserId && redactedBecauseUserId !== mxEvent.getSender()) { const room = cli.getRoom(mxEvent.getRoomId()); const sender = room && room.getMember(redactedBecauseUserId); text = _t("Message deleted by %(name)s", { name: sender ? sender.name : redactedBecauseUserId });