From 1afe26afb3ebf0166131fee7265e3adf6675967e Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Sat, 24 Oct 2015 02:10:58 +0500 Subject: [PATCH] fix check for emptiness of input in htmlFormatMsg() --- js/twister_formatpost.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index 4489050..77e1e10 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -603,6 +603,11 @@ function htmlFormatMsg(msg) { return msg.str; } + if (!msg) { + console.warn('htmlFormatMsg() error: input string is empty'); + return {html: '', mentions: []}; + } + var mentionsChars = 'abcdefghijklmnopqrstuvwxyz_0123456789'; var stopCharsTrailing = '/\\*~_-`.,:;?!%\'"[](){}^|«»…\u201C\u201D\u2026\u2014\u4E00\u3002\uFF0C\uFF1A\uFF1F\uFF01\u3010\u3011\u2047\u2048\u2049'; var stopCharsTrailingUrl = stopCharsTrailing.slice(1);