From 801ed0ea1164aab4f88547322f9d73704388143f Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Tue, 26 Mar 2024 16:04:13 +0000 Subject: [PATCH] Fix cycle operator crashing if step size is larger than the number of operands See https://talk.tiddlywiki.org/t/bug-report-javascript-error-at-tw-com-within-cycle-operator-try-it/9430/1 --- core/modules/filters/x-listops.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/modules/filters/x-listops.js b/core/modules/filters/x-listops.js index 760f581a1..ae17297a5 100644 --- a/core/modules/filters/x-listops.js +++ b/core/modules/filters/x-listops.js @@ -202,7 +202,7 @@ Extended filter operators to manipulate the current list. } if(resultsIndex !== -1) { i = i + step; - nextOperandIndex = (i < opLength ? i : i - opLength); + nextOperandIndex = (i < opLength ? i : i % opLength); if(operands.length > 1) { results.splice(resultsIndex,1,operands[nextOperandIndex]); } else {