From 9466146ce6c2684c2fe8abd8fcab9cf8a13a455e Mon Sep 17 00:00:00 2001 From: bobzel Date: Fri, 30 Oct 2020 14:33:19 -0400 Subject: from last --- src/fields/ScriptField.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/fields/ScriptField.ts') diff --git a/src/fields/ScriptField.ts b/src/fields/ScriptField.ts index 47efccc99..024017302 100644 --- a/src/fields/ScriptField.ts +++ b/src/fields/ScriptField.ts @@ -196,7 +196,7 @@ export class ComputedField extends ScriptField { } Scripting.addGlobal(function getIndexVal(list: any[], index: number) { - return list.reduce((p, x, i) => (i <= index && x !== undefined) || p === undefined ? x : p, undefined as any); + return list?.reduce((p, x, i) => (i <= index && x !== undefined) || p === undefined ? x : p, undefined as any); }, "returns the value at a given index of a list", "(list: any[], index: number)"); Scripting.addGlobal(function makeScript(script: string) { -- cgit v1.2.3-70-g09d2