Skip to content

Commit

Permalink
Address issue where causing NaN chunks
Browse files Browse the repository at this point in the history
Where there are 0 existing CGPS List Chunks, but other existing list(s), the calculation for the next list number would result in NaN
  • Loading branch information
bsyk committed Jan 2, 2025
1 parent 8da6ca6 commit 5f7fb1a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
Expand Down

0 comments on commit 5f7fb1a

Please sign in to comment.