From 8e600f46d9f4a58c648d8b2dd3927db1f7841df8 Mon Sep 17 00:00:00 2001 From: Max Goodhart Date: Thu, 2 Jul 2020 13:59:28 -0700 Subject: [PATCH] Fix crash when attempting to id empty stream --- src/node/data.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/node/data.js b/src/node/data.js index f9a2cf7..28f97b8 100644 --- a/src/node/data.js +++ b/src/node/data.js @@ -84,7 +84,12 @@ export class StreamIDGenerator { if (!localIdMap.has(link)) { let counter = 0 let newId - const normalizedText = (source || label || link) + const idBase = source || label || link + if (!idBase) { + console.warn('skipping empty stream', stream) + continue + } + const normalizedText = idBase .toLowerCase() .replace(/[^\w]/g, '') .replace(/^the|^https?(www)?/, '')