mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix: improve null-safety handling in filter logic
to avoid NullPointerException: it.name must not be null at com.geeksville.mesh.repository.bluetooth.BluetoothRepository$createBondedDevicesFlow$2.invokeSuspend(BluetoothRepository.kt:96)
This commit is contained in:
parent
5599a5d2a5
commit
28b905db23
1 changed files with 1 additions and 1 deletions
|
|
@ -93,7 +93,7 @@ class BluetoothRepository @Inject constructor(
|
|||
return flow<List<BluetoothDevice>> {
|
||||
val devices = adapter.bondedDevices ?: emptySet()
|
||||
while (true) {
|
||||
emit(devices.filter { it.name != null && it.name.matches(Regex(BLE_NAME_PATTERN)) })
|
||||
emit(devices.filter { it.name?.matches(Regex(BLE_NAME_PATTERN)) == true })
|
||||
delay(REFRESH_DELAY_MS)
|
||||
}
|
||||
}.flowOn(dispatchers.default).distinctUntilChanged()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue