Only apply Turtle update if canvas is present
Fixes CODEOCEAN-FRONTEND-4T
This commit is contained in:
@ -81,6 +81,9 @@ function Turtle(unused_pipe_reference, canvas) {
|
|||||||
Turtle.prototype.update = function () {
|
Turtle.prototype.update = function () {
|
||||||
let k, c;
|
let k, c;
|
||||||
const canvas = this.canvas[0];
|
const canvas = this.canvas[0];
|
||||||
|
if (canvas === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
canvas.width = this.get_width() * devicePixelRatio;
|
canvas.width = this.get_width() * devicePixelRatio;
|
||||||
canvas.height = this.get_height() * devicePixelRatio;
|
canvas.height = this.get_height() * devicePixelRatio;
|
||||||
canvas.style.width = `${this.get_width()}px`;
|
canvas.style.width = `${this.get_width()}px`;
|
||||||
|
Reference in New Issue
Block a user