Microbit write bails out if not connected

This commit is contained in:
Eric Rosenbaum 2018-07-12 14:41:28 -04:00
parent 0c21f739ec
commit a7f4fc2212

View file

@ -250,6 +250,7 @@ class MicroBit {
* @private
*/
_writeSessionData (command, message) {
if (!this.getPeripheralIsConnected()) return;
const output = new Uint8Array(message.length + 1);
output[0] = command; // attach command to beginning of message
for (let i = 0; i < message.length; i++) {