Skip to content

Commit 5f9286c

Browse files
fix: avoid crash when readability parser returns null
1 parent 705e961 commit 5f9286c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/utils/get-core-content-text.mjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,13 @@ export function getCoreContentText() {
7171
}
7272

7373
if (isProbablyReaderable(document)) {
74-
let article = new Readability(document.cloneNode(true), {
74+
const article = new Readability(document.cloneNode(true), {
7575
keepClasses: true,
7676
}).parse()
77-
console.log('readerable')
78-
return postProcessText(article.textContent)
77+
if (article?.textContent) {
78+
console.log('readerable')
79+
return postProcessText(article.textContent)
80+
}
7981
}
8082

8183
const largestElement = findLargestElement(document.body)

0 commit comments

Comments
 (0)