Skip to content

Commit 65c57f3

Browse files
committed
fix: kotlin error reading connected devices
1 parent 74b59c2 commit 65c57f3

File tree

1 file changed

+3
-1
lines changed
  • packages/reactive_ble_mobile/android/src/main/kotlin/com/signify/hue/flutterreactiveble

1 file changed

+3
-1
lines changed

packages/reactive_ble_mobile/android/src/main/kotlin/com/signify/hue/flutterreactiveble/PluginController.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,9 @@ class PluginController {
272272
private fun getConnectedDevices(call: MethodCall, result: Result) {
273273
val devices = bleClient.getConnectedDevices().map{ protoConverter.convertToDeviceInfo(it) }
274274
val message = pb.DeviceInfoCollection.newBuilder()
275-
devices.forEachIndexed { index, device -> message.setDevices(index, device)}
275+
if (devices.isNotEmpty()) {
276+
devices.forEachIndexed { index, device -> message.setDevices(index, device)}
277+
}
276278
result.success(message.build().toByteArray())
277279
}
278280
}

0 commit comments

Comments
 (0)