Skip to content

Commit 5607399

Browse files
committed
Fix SBOM counts and caching
1 parent bfa1e6a commit 5607399

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/sbomCollector.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,14 +349,15 @@ export class SbomCollector {
349349
this.decisions[fullName] = (this.decisions[fullName] || "") + ` (branch scan error: ${(e as Error).message})`;
350350
console.debug((e as Error).message);
351351
}
352+
}
352353

353-
if (sbom.error) this.summary.failedCount++; else this.summary.successCount++;
354+
if (!sbom || sbom.error) this.summary.failedCount++; else this.summary.successCount++;
354355

355-
// Write freshly fetched SBOM immediately if a cache directory is configured
356-
if (this.opts.loadFromDir && this.opts.syncSboms && this.opts.loadFromDir.length) {
357-
try { writeOne(sbom, { outDir: this.opts.loadFromDir }); } catch { /* ignore write errors */ }
358-
}
356+
// Write freshly fetched SBOM immediately if a cache directory is configured
357+
if (sbom && !sbom.error && this.opts.loadFromDir && this.opts.syncSboms && this.opts.loadFromDir.length) {
358+
try { writeOne(sbom, { outDir: this.opts.loadFromDir }); } catch { /* ignore write errors */ }
359359
}
360+
360361
if (sbom) {
361362
newSboms.push(sbom);
362363
}

0 commit comments

Comments
 (0)