mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-02 05:04:37 -04: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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user