diff --git a/core/modules/widgets/action-log.js b/core/modules/widgets/action-log.js index b9b9c5267..a8af05a49 100644 --- a/core/modules/widgets/action-log.js +++ b/core/modules/widgets/action-log.js @@ -61,7 +61,7 @@ LogWidget.prototype.log = function() { $tw.utils.each(this.parseTreeNode.attributes,function(attribute,name) { if(name.substring(0,2) !== "$$") { var resultList = self.computeAttribute(attribute,{asList: true}); - if(resultList.length <= 1) { + if(resultList && resultList.length <= 1) { data[name] = resultList[0] || ""; } else { data[name] = resultList; @@ -75,7 +75,7 @@ LogWidget.prototype.log = function() { allVars[v] = variable.value; } else { var variableInfo = this.getVariableInfo(v); - allVars[v] = variableInfo.resultList.length > 1 ? variableInfo.resultList : variableInfo.text; + allVars[v] = variableInfo && variableInfo.resultList && variableInfo.resultList.length > 1 ? variableInfo.resultList : variableInfo.text; } } if(this.filter) { diff --git a/core/modules/widgets/widget.js b/core/modules/widgets/widget.js index da25cf613..e1dbb5296 100755 --- a/core/modules/widgets/widget.js +++ b/core/modules/widgets/widget.js @@ -189,7 +189,7 @@ Widget.prototype.getVariableInfo = function(name,options) { } return { text: text, - resultList: [text] + resultList: text === undefined ? text : [text] }; }; @@ -338,7 +338,7 @@ Widget.prototype.makeFakeWidgetWithVariables = function(vars = {}) { const value = vars[name]; return Array.isArray(value) ? { text: value[0], resultList: value } - : { text: value, resultList: [value] }; + : { text: value, resultList: value === undefined ? value : [value] }; } opts = opts || {}; opts.variables = Object.assign({}, vars, opts.variables || {}); diff --git a/editions/test/tiddlers/tests/data/transclude/MissingTiddlerAttributeVariable.tid b/editions/test/tiddlers/tests/data/transclude/MissingTiddlerAttributeVariable.tid new file mode 100644 index 000000000..eabd1a229 --- /dev/null +++ b/editions/test/tiddlers/tests/data/transclude/MissingTiddlerAttributeVariable.tid @@ -0,0 +1,13 @@ +title: Transclude/MissingTiddlerAttributeVariable +description: Missing Tiddler Attribute Variable +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] + +title: Output +description: hello + +<$transclude tiddler=<> field="description"/> ++ +title: ExpectedResult + +

hello

\ No newline at end of file