condense: Skip over invalid content.

We were defending against `content` being undefined,
which is impossible, instead of checking the length
of the jQuery object.
This commit is contained in:
Steve Howell 2020-04-02 13:24:45 +00:00 committed by Tim Abbott
parent 5245aa457f
commit 249c19b7df

View File

@ -178,8 +178,15 @@ exports.condense_and_collapse = function (elems) {
for (const elem of elems) {
const content = $(elem).find(".message_content");
if (content.length !== 1) {
// We could have a "/me did this" message or something
// else without a `message_content` div.
continue;
}
const message = current_msg_list.get(rows.id($(elem)));
if (content !== undefined && message !== undefined) {
if (message !== undefined) {
const message_height = get_message_height(elem, message.id);
const long_message = message_height > height_cutoff;
if (long_message) {