From 618968dd063faafbb6f1eee849a15bac594e3b4b Mon Sep 17 00:00:00 2001 From: Rhys Koedijk Date: Sun, 29 Sep 2024 03:19:39 +1300 Subject: [PATCH] Fix "undefined is not iterable" (#1358) --- .../utils/azure-devops/AzureDevOpsWebApiClient.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/extension/tasks/dependabotV2/utils/azure-devops/AzureDevOpsWebApiClient.ts b/extension/tasks/dependabotV2/utils/azure-devops/AzureDevOpsWebApiClient.ts index 97fe6cad..475d9df6 100644 --- a/extension/tasks/dependabotV2/utils/azure-devops/AzureDevOpsWebApiClient.ts +++ b/extension/tasks/dependabotV2/utils/azure-devops/AzureDevOpsWebApiClient.ts @@ -96,17 +96,20 @@ export class AzureDevOpsWebApiClient { }, project, ); + if (!pullRequests || pullRequests.length === 0) { + return []; + } return await Promise.all( - pullRequests?.map(async (pr) => { - const properties = (await git.getPullRequestProperties(repository, pr.pullRequestId, project))?.value; + pullRequests.map(async (pr) => { + const properties = (await git.getPullRequestProperties(repository, pr.pullRequestId, project))?.value || {}; return { id: pr.pullRequestId, properties: - Object.keys(properties)?.map((key) => { + Object.keys(properties).map((key) => { return { name: key, - value: properties[key].$value, + value: properties[key]?.$value, }; }) || [], };