Fix attribute of block so that it doesn't have errors if referenced target doesn't exist.

This commit is contained in:
Karishma Chadha 2018-05-03 13:37:45 -04:00
parent 7d36054cf6
commit 9cc34d7406

View file

@ -264,6 +264,11 @@ class Scratch3SensingBlocks {
attrTarget = this.runtime.getSpriteTargetByName(args.OBJECT);
}
// attrTarget can be undefined if the target does not exist
// (e.g. single sprite uploaded from larger project referencing
// another sprite that wasn't uploaded)
if (!attrTarget) return 0;
// Generic attributes
if (attrTarget.isStage) {
switch (args.PROPERTY) {