From a98f3af2e1bea648e51a184897c42ddb75d1bb8b Mon Sep 17 00:00:00 2001 From: Kevin Andersen Date: Fri, 12 Apr 2019 13:56:29 -0400 Subject: [PATCH] Added a special case in motorOnForRotation() to avoid hanging blocks if power is 0 --- src/extensions/scratch3_boost/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/extensions/scratch3_boost/index.js b/src/extensions/scratch3_boost/index.js index b46b546f5..87f1937f1 100644 --- a/src/extensions/scratch3_boost/index.js +++ b/src/extensions/scratch3_boost/index.js @@ -1695,6 +1695,8 @@ class Scratch3BoostBlocks { const promises = motors.map(portID => { const motor = this._peripheral.motor(portID); if (motor) { + // to avoid a hanging block if power is 0, return an immediately resolving promise. + if (motor.power === 0) return new Promise(resolve => resolve()); return new Promise(resolve => { motor.turnOnForDegrees(degrees, sign); motor.pendingPromiseFunction = resolve;