Skip to content

Commit 270a955

Browse files
committed
WebViewPreview: fixed occasional JSException: TypeError: null is not an object (evaluating 'document.body.scrollHeight')
1 parent 141249c commit 270a955

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/main/java/org/markdownwriterfx/preview/WebViewPreview.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ public void update(Renderer renderer, Path path) {
103103
@Override
104104
public void scrollY(double value) {
105105
webView.getEngine().executeScript(
106-
"window.scrollTo(0, (document.body.scrollHeight - window.innerHeight) * "+value+");");
106+
"if(document.body != null)" +
107+
" window.scrollTo(0, (document.body.scrollHeight - window.innerHeight) * "+value+");");
107108
}
108109

109110
@Override

0 commit comments

Comments
 (0)