diff --git a/server/src/score-import/framework/core/pb/process-pbs.ts b/server/src/score-import/framework/core/pb/process-pbs.ts index b0e3727cd..2b5923d05 100644 --- a/server/src/score-import/framework/core/pb/process-pbs.ts +++ b/server/src/score-import/framework/core/pb/process-pbs.ts @@ -12,6 +12,19 @@ export async function ProcessPBs(userID: integer, chartIDs: Set, logger: let pbDocs = (await Promise.all(promises)).filter((e) => !!e) as PBScoreDocument[]; + if (pbDocs.length === 0) { + let toStr = ""; + for (const c of chartIDs) { + toStr += `${c},`; + } + + logger.warn( + `Skipping PB processing as pbDocs is an empty array. This was probably caused by a previous severe-level warning.`, + { userID, chartIDs: toStr } + ); + return 0; + } + let r = await db["score-pbs"].bulkWrite( pbDocs.map((e) => ({ updateOne: {