From 2012fec1bb1bd5d7a27bc390d8f0a447a8d6d716 Mon Sep 17 00:00:00 2001 From: beerose Date: Fri, 20 Oct 2023 12:35:01 -0500 Subject: [PATCH] fix 'undefined is not iterable' when printing json output --- src/print-trace-analysis-json.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/print-trace-analysis-json.ts b/src/print-trace-analysis-json.ts index da61823..4c70842 100644 --- a/src/print-trace-analysis-json.ts +++ b/src/print-trace-analysis-json.ts @@ -111,7 +111,7 @@ async function getHotSpotsWorker(curr: EventSpan, currentFile: string | undefine // Sort slow to fast const sortedChildren = curr.children.sort((a, b) => (b.end - b.start) - (a.end - a.start)); for (const child of sortedChildren) { - children.push(...await getHotSpotsWorker(child, currentFile, positionMap, relatedTypes, importExpressionThreshold)); + children.push(...(await getHotSpotsWorker(child, currentFile, positionMap, relatedTypes, importExpressionThreshold) || [])); } }