Commit 53b12399 authored by JC Brand's avatar JC Brand

Avoid inserting invalid dates and/or empty divs

parent aac8b741
......@@ -536,6 +536,9 @@ converse.plugins.add('converse-chatview', {
prev_msg_date = _.isNull(prev_msg_el) ? null : prev_msg_el.getAttribute('data-isodate'),
next_msg_date = next_msg_el.getAttribute('data-isodate');
if (_.isNull(prev_msg_date) && _.isNull(next_msg_date)) {
return;
}
if (_.isNull(prev_msg_date) || moment(next_msg_date).isAfter(prev_msg_date, 'day')) {
const day_date = moment(next_msg_date).startOf('day');
next_msg_el.insertAdjacentHTML('beforeBegin',
......@@ -725,7 +728,10 @@ converse.plugins.add('converse-chatview', {
*/
const view = new _converse.MessageView({'model': message});
await view.render();
if (!view.el.innerHTML) {
return _converse.log("showMessage: message's view element is empty", Strophe.LogLevel.ERROR);
}
this.clearChatStateNotification(message);
this.insertMessage(view);
this.insertDayIndicator(view.el);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment