WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit eb75438

Browse files
authored
add canvas context check in $updateDecorators method (#5833)
1 parent 896c9da commit eb75438

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/ext/diff/scroll_diff_decorator.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ class ScrollDiffDecorator extends Decorator {
4141
}
4242

4343
$updateDecorators(config) {
44+
if (typeof this.canvas.getContext !== "function") {
45+
return;
46+
}
4447
super.$updateDecorators(config);
4548
if (this.$zones.length > 0) {
4649
var colors = (this.renderer.theme.isDark === true) ? this.colors.dark : this.colors.light;

src/layer/decorators.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ class Decorator {
4848
}
4949

5050
$updateDecorators(config) {
51+
if (typeof this.canvas.getContext !== "function") {
52+
return;
53+
}
5154
var colors = (this.renderer.theme.isDark === true) ? this.colors.dark : this.colors.light;
5255
this.setDimensions(config);
5356

0 commit comments

Comments
 (0)