Skip to content

Commit d1bb3f3

Browse files
author
Daisuke Baba
committed
Return empty when the peripheral is missing
1 parent 2781813 commit d1bb3f3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/generic-ble.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ export default function(RED) {
240240
this.operations = {
241241
preparePeripheral: () => {
242242
let peripheral = noble._peripherals[this.uuid];
243+
if (!peripheral) {
244+
return Promise.resolve();
245+
}
243246
switch (peripheral.state) {
244247
case 'disconnected': {
245248
this.emit('disconnected');

0 commit comments

Comments
 (0)