Skip to content

Commit 393c374

Browse files
author
sheepzh
committed
Fix error in non-html page (#174)
1 parent e19a987 commit 393c374

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/content-script/limit.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ class _Modal {
5252
}
5353

5454
showModal(showDelay: boolean) {
55+
if (!document.body) {
56+
return
57+
}
5558
const _thisUrl = this.url
5659
if (showDelay && this.mask.childElementCount === 1) {
5760
this.delayContainer = document.createElement('p')
@@ -84,7 +87,7 @@ class _Modal {
8487
}
8588

8689
hideModal() {
87-
if (!this.visible) {
90+
if (!this.visible || document.body) {
8891
return
8992
}
9093
this.mask.remove()

0 commit comments

Comments
 (0)