Fallback to empty string if content is undefined

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-05-11 13:43:54 +05:30
parent 577883a1d4
commit 070bc96186

View file

@ -20,7 +20,7 @@ import { MessageBodyBuilder } from "../MessageBodyBuilder.js";
export class TextTile extends MessageTile { export class TextTile extends MessageTile {
get messageFormat() { get messageFormat() {
const content = this._getContent(); const content = this._getContent();
let body = content && content.body; let body = content?.body || "";
if (content.msgtype === "m.emote") { if (content.msgtype === "m.emote") {
body = `* ${this.displayName} ${body}`; body = `* ${this.displayName} ${body}`;
} }