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
This commit is contained in:
Jeremy Ruston 2024-03-26 16:04:13 +00:00
parent 31ec1bdd50
commit 801ed0ea11
1 changed files with 1 additions and 1 deletions

View File

@ -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 {