From 485779f5b2136b7bcd739352b56188d94b0eb9e4 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Sat, 22 May 2021 20:00:24 +0100 Subject: [PATCH] Fix crash when accessing variables in filters that don't have a widget context This should catch a large number of crashes, including: Fixes #5716 --- core/modules/filters.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/modules/filters.js b/core/modules/filters.js index 7799b23d6..89a9e8ccf 100644 --- a/core/modules/filters.js +++ b/core/modules/filters.js @@ -323,6 +323,9 @@ exports.compileFilter = function(filterString) { } else if(typeof source === "object") { // Array or hashmap source = self.makeTiddlerIterator(source); } + if(!widget) { + widget = $tw.rootWidget; + } var results = new $tw.utils.LinkedList(); $tw.utils.each(operationFunctions,function(operationFunction) { operationFunction(results,source,widget);