Merge pull request #495 from paulkaplan/fix-target-id

Add check to make sure `target` exists
This commit is contained in:
Paul Kaplan 2017-03-08 12:13:10 -05:00 committed by GitHub
commit 2ebb112d30

View file

@ -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;