From 664dadf404c723e81c9063c30e4634e42d7d8b94 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Wed, 11 Nov 2020 17:35:06 +0100 Subject: [PATCH] Check for coords before using it --- app/assets/javascripts/turtle.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/turtle.js b/app/assets/javascripts/turtle.js index 78694bcd..eee8dfcb 100644 --- a/app/assets/javascripts/turtle.js +++ b/app/assets/javascripts/turtle.js @@ -180,10 +180,13 @@ Turtle.prototype.create_polygon = function () { // XXX might make this varargs as in Tkinter Turtle.prototype.coords = function (item, coords) { - if (coords === undefined) { + if (this.items[item] === undefined) { + return; + } else if (coords === undefined) { return this.items[item].coords; + } else { + this.items[item].coords = coords; } - this.items[item].coords = coords; }; Turtle.prototype.itemconfigure = function (item, key, value) {