Make $tw.utils.stringifyList() resilient to null values in the array

This commit is contained in:
Jermolene 2016-09-30 18:28:12 +01:00
parent b867b7487e
commit 20daaae7e8
1 changed files with 12 additions and 7 deletions

View File

@ -251,15 +251,20 @@ $tw.utils.parseDate = function(value) {
// Stringify an array of tiddler titles into a list string
$tw.utils.stringifyList = function(value) {
var result = [];
for(var t=0; t<value.length; t++) {
if(value[t].indexOf(" ") !== -1) {
result.push("[[" + value[t] + "]]");
} else {
result.push(value[t]);
if($tw.utils.isArray(value)) {
var result = [];
for(var t=0; t<value.length; t++) {
var entry = value[t] || "";
if(entry.indexOf(" ") !== -1) {
result.push("[[" + entry + "]]");
} else {
result.push(entry);
}
}
return result.join(" ");
} else {
return value || "";
}
return result.join(" ");
};
// Parse a string array from a bracketted list. For example "OneTiddler [[Another Tiddler]] LastOne"