From 5f7fb1a2723860585319290a64ddde08353f2e90 Mon Sep 17 00:00:00 2001 From: Ben Sykes Date: Thu, 2 Jan 2025 09:21:39 -0800 Subject: [PATCH] Address issue where causing NaN chunks Where there are 0 existing CGPS List Chunks, but other existing list(s), the calculation for the next list number would result in NaN --- lib/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/api.js b/lib/api.js index 13e43bdd..362b2d44 100644 --- a/lib/api.js +++ b/lib/api.js @@ -165,7 +165,7 @@ export const synchronizeZeroTrustLists = async (items) => { // Are there any more appends remaining? if (toAdd.length) { // We'll need to create new list(s) - const nextListNumber = Math.max(cgpsLists.map(list => parseInt(list.name.replace('CGPS List - Chunk ', '')))) + 1; + const nextListNumber = Math.max(cgpsLists.map(list => parseInt(list.name.replace('CGPS List - Chunk ', ''))).filter(x => !isNaN(x))) + 1; await createZeroTrustListsOneByOne(toAdd, nextListNumber); } };