From 509c1d971ee6dba33f30f40ee9f4226d8c370b05 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 19 Dec 2022 17:30:10 +0800 Subject: [PATCH] Return 0 if no html --- src/utils/html-content-length.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/html-content-length.js b/src/utils/html-content-length.js index d01cb130..517f5efc 100644 --- a/src/utils/html-content-length.js +++ b/src/utils/html-content-length.js @@ -1,5 +1,6 @@ const div = document.createElement('div'); export default function htmlContentLength(html) { + if (!html) return 0; div.innerHTML = html; return div.innerText.length; }