diff --git a/src/lib/github.ts b/src/lib/github.ts index 8c03494..60bd691 100644 --- a/src/lib/github.ts +++ b/src/lib/github.ts @@ -668,10 +668,15 @@ export async function fetchCollaboratorsForYear( const collaboratorMap = new Map(); const collection = data.user.contributionsCollection; + // If the user doesn't have contributions + if (!collection) { + return []; + } + // Process PR contributors for (const pr of collection.pullRequestContributions?.nodes ?? []) { // Skip if pullRequest is null (deleted PRs) - if (!pr.pullRequest) continue; + if (!pr || !pr.pullRequest) continue; if (pr.pullRequest.author && pr.pullRequest.author.login !== username) { const login = pr.pullRequest.author.login;