From 3d5f55f8edc7aad10865edb4fb9570165cc5d81f Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Fri, 17 Nov 2023 14:52:02 +0100 Subject: [PATCH] Only apply Turtle update if canvas is present Fixes CODEOCEAN-FRONTEND-4T --- app/assets/javascripts/turtle.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/assets/javascripts/turtle.js b/app/assets/javascripts/turtle.js index d475eac9..536f24a7 100644 --- a/app/assets/javascripts/turtle.js +++ b/app/assets/javascripts/turtle.js @@ -81,6 +81,9 @@ function Turtle(unused_pipe_reference, canvas) { Turtle.prototype.update = function () { let k, c; const canvas = this.canvas[0]; + if (canvas === undefined) { + return; + } canvas.width = this.get_width() * devicePixelRatio; canvas.height = this.get_height() * devicePixelRatio; canvas.style.width = `${this.get_width()}px`;