Prevent access to undefined turtle element
This commit is contained in:
@ -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
|
||||||
|
Reference in New Issue
Block a user