Skip to content

Commit

Permalink
Check array length
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilWindle committed Jan 9, 2025
1 parent e6a857d commit a9daf6f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion yarn-project/circuit-types/src/interfaces/proving-job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ export const makeProvingJobId = (epochNumber: number, type: ProvingRequestType,

export const getEpochFromProvingJobId = (id: ProvingJobId) => {
const components = id.split(':');
const epochNumber = parseInt(components[0], 10);
const epochNumber = components.length < 1 ? Number.NaN : parseInt(components[0], 10);
if (!Number.isSafeInteger(epochNumber) || epochNumber < 0) {
throw new Error(`Proving Job ID ${id} does not contain valid epoch`);
}
Expand Down

0 comments on commit a9daf6f

Please sign in to comment.