Skip to content

Commit 3d4511a

Browse files
committed
Fix undefined error
1 parent 296dd3d commit 3d4511a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/switchbot.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ class Switchbot {
132132
for (let addr in peripherals) {
133133
device_list.push(peripherals[addr]);
134134
}
135-
resolve(device_list);
135+
if (device_list.length) {
136+
resolve(device_list);
137+
}
136138
};
137139

138140
// Set a handler for the 'discover' event

0 commit comments

Comments
 (0)