diff --git a/src/virtual-machine.js b/src/virtual-machine.js index fce3244ad..f85caf4b7 100644 --- a/src/virtual-machine.js +++ b/src/virtual-machine.js @@ -222,7 +222,11 @@ class VirtualMachine extends EventEmitter { } } // Select the first target for editing, e.g., the first sprite. - this.editingTarget = this.runtime.targets[1]; + if (this.runtime.targets.length > 1) { + this.editingTarget = this.runtime.targets[1]; + } else { + this.editingTarget = this.runtime.targets[0]; + } // Update the VM user's knowledge of targets and blocks on the workspace. this.emitTargetsUpdate();