Skip to content

Commit 461962b

Browse files
committed
Android: Fix null pointer exception when scanning BT-devices
1 parent e6d895e commit 461962b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ See [metadata/en-US/changelogs](metadata/en-US/changelogs) for all changelogs.
3333
- Lib: Fix infinite loop when parsing broken GPX-files (Issue #174)
3434
- Lib: Fix ignoring altitude precision when reading and displaying tracks
3535
- Android & GTK: Fix map border does not always receive click events
36-
- Android & GTK: Fix preview image generation (wrong bounding in draw function)
36+
- Android & GTK: Fix preview image generation (wrong bounding in draw function)
37+
- Android: Fix null pointer exception when scanning BT-devices

aat-android/src/main/kotlin/ch/bailu/aat/services/sensor/bluetooth_le/BleSensors.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ class BleSensors(private val scontext: ServiceContext, private val sensorList: S
6060

6161
@Synchronized
6262
fun foundDevice(device: BluetoothDevice) {
63-
val item = sensorList.add(device.address, device.name)
63+
val displayName = device.name ?: device.address
64+
val item = sensorList.add(device.address, displayName)
6465
if (item.isUnscannedOrScanning) {
6566
BleSensor(scontext, device, sensorList, item)
6667
}

0 commit comments

Comments
 (0)