From 5737e152ac00d4f7059c6f215c33c73642fdffef Mon Sep 17 00:00:00 2001 From: "K.R." Date: Wed, 18 Sep 2024 08:50:56 -0400 Subject: [PATCH] Wrap SavedExtension in try-catch Some sb2 records don't contain Extensions expected by clients (ie. env-crawler). --- lib/sb2.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/sb2.js b/lib/sb2.js index 9681c1b..567b6a2 100644 --- a/lib/sb2.js +++ b/lib/sb2.js @@ -166,7 +166,14 @@ const blocks = function (project) { */ const extensions = function (project) { const result = {count: 0, id: []}; - const ext = project.info.savedExtensions; + + try { + const ext = project.info.savedExtensions; + } catch (error) { + if (error instanceof TypeError) { + console.log("A TypeError occurred:", error.message); + } + } // Check to ensure project includes any extensions if (typeof ext === 'undefined') return result;