crash in message preview on empty topic

This commit is contained in:
or-else
2022-02-17 16:07:59 -08:00
parent e5545f5f14
commit fb45c442a8
10 changed files with 35 additions and 17 deletions
+5 -3
View File
@@ -84,9 +84,11 @@ class ContactList extends React.Component {
if (msg) {
forwarded = msg.head ? msg.head.forwarded : null;
deliveryStatus = msg._status || c.msgStatus(msg, true);
preview = typeof msg.content == 'string' ?
msg.content.substr(0, MESSAGE_PREVIEW_LENGTH) :
Drafty.preview(msg.content, MESSAGE_PREVIEW_LENGTH);
if (msg.content) {
preview = typeof msg.content == 'string' ?
msg.content.substr(0, MESSAGE_PREVIEW_LENGTH) :
Drafty.preview(msg.content, MESSAGE_PREVIEW_LENGTH);
}
}
}