Add check to make sure target exists

This commit is contained in:
Paul Kaplan 2017-03-08 11:40:02 -05:00
parent bf2303f6de
commit 8aaadf2fab

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;