1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-30 05:19:57 +00:00

Fix csvtiddlers macro crash with missing tiddlers

Fixes #8039
This commit is contained in:
Jeremy Ruston 2024-03-06 08:36:37 +00:00
parent 7d25b13970
commit 69e828fc30

View File

@ -35,12 +35,14 @@ exports.run = function(filter,format) {
// Collect all the fields
for(t=0;t<tiddlers.length; t++) {
tiddler = this.wiki.getTiddler(tiddlers[t]);
if(tiddler) {
for(f in tiddler.fields) {
if(fields.indexOf(f) === -1) {
fields.push(f);
}
}
}
}
// Sort the fields and bring the standard ones to the front
fields.sort();
"title text modified modifier created creator".split(" ").reverse().forEach(function(value,index) {
@ -60,9 +62,11 @@ exports.run = function(filter,format) {
for(var t=0;t<tiddlers.length; t++) {
row = [];
tiddler = this.wiki.getTiddler(tiddlers[t]);
if(tiddler) {
for(f=0; f<fields.length; f++) {
row.push(quoteAndEscape(tiddler ? tiddler.getFieldString(fields[f]) || "" : ""));
}
}
output.push(row.join(","));
}
return output.join("\n");