From 1a16748769acf955939cc131baf71a4bf0ed3289 Mon Sep 17 00:00:00 2001 From: dhrumit parmar Date: Mon, 22 Jul 2024 18:05:47 +0530 Subject: [PATCH] Handle nullable values while scraping discussion --- scraper/src/github-scraper/discussion.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scraper/src/github-scraper/discussion.ts b/scraper/src/github-scraper/discussion.ts index a7eb456f..f415fb85 100644 --- a/scraper/src/github-scraper/discussion.ts +++ b/scraper/src/github-scraper/discussion.ts @@ -138,12 +138,14 @@ export async function scrapeDiscussions( endDate, startDate, ); - const parsedDiscussions = await parseDiscussionData( - allDiscussions, - endDate, - startDate, - ); - await saveDiscussionData(parsedDiscussions, dataDir); + if (allDiscussions) { + const parsedDiscussions = await parseDiscussionData( + allDiscussions, + endDate, + startDate, + ); + await saveDiscussionData(parsedDiscussions, dataDir); + } } catch (error: any) { throw new Error(`Error fetching discussions: ${error.message}`); }