From d2933b896e16226053f4e008cc1b2a0b5d120b3c Mon Sep 17 00:00:00 2001 From: JC Brand Date: Fri, 17 Jun 2016 09:33:09 +0000 Subject: [PATCH] Ignore messages without a body --- src/converse-notification.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/converse-notification.js b/src/converse-notification.js index e8fb4224f..9624e9cd8 100644 --- a/src/converse-notification.js +++ b/src/converse-notification.js @@ -63,8 +63,11 @@ return false; } var room = converse.chatboxes.get(room_jid); - var body = $message.children('body').text(); - var mentioned = (new RegExp("\\b"+room.get('nick')+"\\b")).test(body); + var $body = $message.children('body'); + if (!$body.length) { + return false; + } + var mentioned = (new RegExp("\\b"+room.get('nick')+"\\b")).test($body.text()); notify_all = notify_all === true || (_.isArray(notify_all) && _.contains(notify_all, room_jid)); if (sender === room.get('nick') || (!notify_all && !mentioned)) { return false;