From 04c00bc9be3001340c20e1ae0f2d96a0ab9ab13d Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Wed, 21 Sep 2022 14:10:24 +0100 Subject: [PATCH] fix: added check for existing key in loop --- src/lib/ecosystems/resolve-test-facts.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lib/ecosystems/resolve-test-facts.ts b/src/lib/ecosystems/resolve-test-facts.ts index 91cd787b7c..f3b9a7f384 100644 --- a/src/lib/ecosystems/resolve-test-facts.ts +++ b/src/lib/ecosystems/resolve-test-facts.ts @@ -264,12 +264,14 @@ export async function resolveAndTestFactsRegistry( const vulnerabilities: IssueData[] = []; for (const issuesDataKey in response.issuesData) { - const issueData = response.issuesData[issuesDataKey]; - const pkgCoordinate = `${issuesMap[issuesDataKey].pkgName}@${issuesMap[issuesDataKey].pkgVersion}`; - issueData.from = [pkgCoordinate]; - issueData.name = pkgCoordinate; - issueData.packageManager = packageManager; - vulnerabilities.push(issueData); + if (issuesMap[issuesDataKey]) { + const issueData = response.issuesData[issuesDataKey]; + const pkgCoordinate = `${issuesMap[issuesDataKey].pkgName}@${issuesMap[issuesDataKey].pkgVersion}`; + issueData.from = [pkgCoordinate]; + issueData.name = pkgCoordinate; + issueData.packageManager = packageManager; + vulnerabilities.push(issueData); + } } const dependencyCount = response?.depGraphData?.graph?.nodes?.find(