From 4b0cf20ad84617b6efa7f0e90f30dbca300a4c59 Mon Sep 17 00:00:00 2001 From: piyushjindal Date: Tue, 3 Oct 2023 11:18:05 +0530 Subject: [PATCH] Minor change wrt to null check --- tools/importer/import-news-press-healthythinking.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/importer/import-news-press-healthythinking.js b/tools/importer/import-news-press-healthythinking.js index d4e550b2..e5701c69 100644 --- a/tools/importer/import-news-press-healthythinking.js +++ b/tools/importer/import-news-press-healthythinking.js @@ -58,11 +58,14 @@ const createFragmentBlockFromSection = (document) => { block.push(['https://main--sunstar--hlxsites.hlx.page/fragments/featured-articles']); section = newsPressCard; } - const table = WebImporter.DOMUtils.createTable(block, document); - section.before(document.createElement('hr')); - section.before(document.querySelector('.slider-title')); - section.after(document.createElement('hr')); - section.replaceWith(table); + + if (section) { + const table = WebImporter.DOMUtils.createTable(block, document); + section.before(document.createElement('hr')); + section.before(document.querySelector('.slider-title')); + section.after(document.createElement('hr')); + section.replaceWith(table); + } }; const addSocialBlock = (document) => {