From 2a5a74a51e5107d2ad17b4040de56cffcc6b1bd3 Mon Sep 17 00:00:00 2001 From: Rey Ramos Date: Fri, 29 May 2020 18:51:08 -0400 Subject: [PATCH] Update html2json.js thrown error of undefined/child added validation if Parent exist, check for child --- src/html2json.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/html2json.js b/src/html2json.js index 65a3595..01a7c3c 100644 --- a/src/html2json.js +++ b/src/html2json.js @@ -113,10 +113,10 @@ text: text, }; var parent = bufArray[0]; - if (parent.child === undefined) { + if (parent && parent.child === undefined) { parent.child = []; } - parent.child.push(node); + if(parent)parent.child.push(node); }, }); return results;