return empty string instead of blowing up when fixing HTML

pull/1/head
ansuz 8 years ago
parent e3f26263f4
commit a9afa24428

@ -164,6 +164,7 @@ define([
var isArray = common.isArray = $.isArray; var isArray = common.isArray = $.isArray;
var fixHTML = common.fixHTML = function (str) { var fixHTML = common.fixHTML = function (str) {
if (!str) { return ''; }
return str.replace(/[<>&"']/g, function (x) { return str.replace(/[<>&"']/g, function (x) {
return ({ "<": "&lt;", ">": "&gt", "&": "&amp;", '"': "&#34;", "'": "&#39;" })[x]; return ({ "<": "&lt;", ">": "&gt", "&": "&amp;", '"': "&#34;", "'": "&#39;" })[x];
}); });

Loading…
Cancel
Save