Prevent access to undefined turtle element

This commit is contained in:
Sebastian Serth
2021-01-25 11:27:00 +01:00
parent 366a792bf0
commit b78c535671

View File

@ -190,7 +190,10 @@ Turtle.prototype.coords = function (item, coords) {
}; };
Turtle.prototype.itemconfigure = function (item, key, value) { Turtle.prototype.itemconfigure = function (item, key, value) {
this.items[item][key] = value; const element = this.items[item];
if (element !== undefined) {
element[key] = value;
}
}; };
// value might be undefined // value might be undefined