From b7a59c7d07b67d1240df083c65751ad05d88f673 Mon Sep 17 00:00:00 2001 From: Prabhu Subramanian Date: Thu, 31 Oct 2024 14:59:49 +0000 Subject: [PATCH] Bug fix Signed-off-by: Prabhu Subramanian --- lib/stages/postgen/postgen.js | 6 ++++-- types/lib/stages/postgen/postgen.d.ts.map | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/stages/postgen/postgen.js b/lib/stages/postgen/postgen.js index 6f0045780..b1df3d549 100644 --- a/lib/stages/postgen/postgen.js +++ b/lib/stages/postgen/postgen.js @@ -205,8 +205,10 @@ export function filterBom(bomJson, options) { for (const aref of Object.keys(newPkgMap).sort()) { newcomponents.push(newPkgMap[aref]); } - newPkgMap[bomJson.metadata.component["bom-ref"]] = - bomJson.metadata.component; + if (bomJson.metadata?.component?.["bom-ref"]) { + newPkgMap[bomJson.metadata.component["bom-ref"]] = + bomJson.metadata.component; + } if (bomJson.metadata.component.components) { for (const comp of bomJson.metadata.component.components) { newPkgMap[comp["bom-ref"]] = comp; diff --git a/types/lib/stages/postgen/postgen.d.ts.map b/types/lib/stages/postgen/postgen.d.ts.map index f06438b1c..3c8c399b5 100644 --- a/types/lib/stages/postgen/postgen.d.ts.map +++ b/types/lib/stages/postgen/postgen.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"postgen.d.ts","sourceRoot":"","sources":["../../../../lib/stages/postgen/postgen.js"],"names":[],"mappings":"AAWA;;;;;;;GAOG;AACH,+DAcC;AAED;;;;;;;GAOG;AACH,gEAqCC;AAED;;;;;;;GAOG;AACH,gEA+BC;AAED;;;;;;;GAOG;AACH,2DAuIC;AAED;;GAEG;AACH,gDAIC"} \ No newline at end of file +{"version":3,"file":"postgen.d.ts","sourceRoot":"","sources":["../../../../lib/stages/postgen/postgen.js"],"names":[],"mappings":"AAWA;;;;;;;GAOG;AACH,+DAcC;AAED;;;;;;;GAOG;AACH,gEAqCC;AAED;;;;;;;GAOG;AACH,gEA+BC;AAED;;;;;;;GAOG;AACH,2DAyIC;AAED;;GAEG;AACH,gDAIC"} \ No newline at end of file