From c55c20e09c2bcbb3134a2b9b14d9b8ca5cb77526 Mon Sep 17 00:00:00 2001
From: Erwan Raulo <erwan.raulo2015@campus-eni.fr>
Date: Wed, 25 Dec 2024 15:00:08 +0100
Subject: [PATCH] fix: scanner payload & teardown after failure (#432)

fix #431
---
 bin/commands/execute.js            | 1 -
 src/analysis/extractScannerData.js | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/bin/commands/execute.js b/bin/commands/execute.js
index d952ace..bd1ca69 100644
--- a/bin/commands/execute.js
+++ b/bin/commands/execute.js
@@ -54,7 +54,6 @@ export async function execute(options = {}) {
       })
       .catch((error) => {
         console.error(error);
-        process.exit(0);
       })
       .finally(teardown);
   });
diff --git a/src/analysis/extractScannerData.js b/src/analysis/extractScannerData.js
index d945821..77623e6 100644
--- a/src/analysis/extractScannerData.js
+++ b/src/analysis/extractScannerData.js
@@ -98,7 +98,7 @@ export async function buildStatsFromNsecurePayloads(payloadFiles = [], options =
         if (curr.versions.has(localVersion)) {
           continue;
         }
-        const { flags, size, composition, uniqueLicenseIds, author, warnings = [], links } = localDescriptor;
+        const { flags, size, composition, uniqueLicenseIds, author, warnings = [], links = [] } = localDescriptor;
 
         stats.size.all += size;
         stats.size[isThird ? "external" : "internal"] += size;