diff --git a/lib/validate.js b/lib/validate.js index 88ca62a5..59e554b8 100644 --- a/lib/validate.js +++ b/lib/validate.js @@ -83,12 +83,12 @@ export function advPostSchemaMembers (client) { .compact((v) => !v.nym && !v.pct) .test({ name: 'sum', - test: forwards => forwards.map(fwd => Number(fwd.pct)).reduce((sum, cur) => sum + cur, 0) <= 100, + test: forwards => forwards ? forwards.map(fwd => Number(fwd.pct)).reduce((sum, cur) => sum + cur, 0) <= 100 : true, message: 'the total forward percentage exceeds 100%' }) .test({ name: 'uniqueStackers', - test: forwards => new Set(forwards.map(fwd => fwd.nym)).size === forwards.length, + test: forwards => forwards ? new Set(forwards.map(fwd => fwd.nym)).size === forwards.length : true, message: 'duplicate stackers cannot be specified to receive forwarded sats' }) }