Merge pull request #3596 from matrix-org/dbkr/fix_editing_softcrash

Fix softcrash if editing silly events
This commit is contained in:
David Baker 2019-11-06 11:53:18 +00:00 committed by GitHub
commit e2acc90fbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,6 +52,7 @@ export function canEditContent(mxEvent) {
const content = mxEvent.getOriginalContent(); const content = mxEvent.getOriginalContent();
const {msgtype} = content; const {msgtype} = content;
return (msgtype === "m.text" || msgtype === "m.emote") && return (msgtype === "m.text" || msgtype === "m.emote") &&
content.body && typeof content.body === 'string' &&
mxEvent.getSender() === MatrixClientPeg.get().getUserId(); mxEvent.getSender() === MatrixClientPeg.get().getUserId();
} }