mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 06:23:37 -05:00
Merge pull request #495 from paulkaplan/fix-target-id
Add check to make sure `target` exists
This commit is contained in:
commit
2ebb112d30
1 changed files with 1 additions and 1 deletions
|
@ -336,7 +336,7 @@ VirtualMachine.prototype.emitWorkspaceUpdate = function () {
|
|||
*/
|
||||
VirtualMachine.prototype.getTargetIdForDrawableId = function (drawableId) {
|
||||
var target = this.runtime.getTargetByDrawableId(drawableId);
|
||||
if (target.hasOwnProperty('id') && target.hasOwnProperty('isStage') && !target.isStage) {
|
||||
if (target && target.hasOwnProperty('id') && target.hasOwnProperty('isStage') && !target.isStage) {
|
||||
return target.id;
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Reference in a new issue