Skip to content

Commit 0f4a9c3

Browse files
committed
Fix TypeError: Node is null when scrolling
1 parent 81f7da6 commit 0f4a9c3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

common/content/buffer.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,12 @@ const Buffer = Module("buffer", {
10951095

10961096
scrollVertical: function scrollVertical(elem, increment, number) {
10971097
elem = elem || Buffer.findScrollable(number, false);
1098+
1099+
if (elem == null && buffer.loaded == 0) {
1100+
liberator.echoerr("Page is still loading");
1101+
return;
1102+
}
1103+
10981104
let fontSize = parseInt(util.computedStyle(elem).fontSize);
10991105
if (increment == "lines")
11001106
increment = fontSize;
@@ -1108,6 +1114,12 @@ const Buffer = Module("buffer", {
11081114

11091115
scrollHorizontal: function scrollHorizontal(elem, increment, number) {
11101116
elem = elem || Buffer.findScrollable(number, true);
1117+
1118+
if (elem == null && buffer.loaded == 0) {
1119+
liberator.echoerr("Page is still loading");
1120+
return;
1121+
}
1122+
11111123
let fontSize = parseInt(util.computedStyle(elem).fontSize);
11121124
if (increment == "columns")
11131125
increment = fontSize; // Good enough, I suppose.

0 commit comments

Comments
 (0)